[Assorted-commits] SF.net SVN: assorted:[1879] sandbox/trunk/src/web
Brought to you by:
yangzhang
|
From: <yan...@us...> - 2014-03-22 20:27:50
|
Revision: 1879
http://sourceforge.net/p/assorted/svn/1879
Author: yangzhang
Date: 2014-03-22 20:27:47 +0000 (Sat, 22 Mar 2014)
Log Message:
-----------
Add old React experiments
Added Paths:
-----------
sandbox/trunk/src/web/react/
sandbox/trunk/src/web/react/go.bash
sandbox/trunk/src/web/react/index.coffee
sandbox/trunk/src/web/react/index.jade
sandbox/trunk/src/web/react/package.json
Index: sandbox/trunk/src/web/react
===================================================================
--- sandbox/trunk/src/web/react 2014-03-08 23:01:49 UTC (rev 1878)
+++ sandbox/trunk/src/web/react 2014-03-22 20:27:47 UTC (rev 1879)
Property changes on: sandbox/trunk/src/web/react
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,3 ##
+index.js
+index.html
+node_modules
Added: sandbox/trunk/src/web/react/go.bash
===================================================================
--- sandbox/trunk/src/web/react/go.bash (rev 0)
+++ sandbox/trunk/src/web/react/go.bash 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,2 @@
+./node_modules/.bin/jade index.jade
+./node_modules/.bin/watchify -v -o index.js -t coffeeify index.coffee
Added: sandbox/trunk/src/web/react/index.coffee
===================================================================
--- sandbox/trunk/src/web/react/index.coffee (rev 0)
+++ sandbox/trunk/src/web/react/index.coffee 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,32 @@
+_ = require 'underscore'
+$ = require 'jquery'
+React = require 'react'
+R = React.DOM
+
+Foo = React.createClass(
+ getInitialState: ->
+ counter: @props.initCount
+ componentDidUpdate: ->
+ console.log 'updated', @props, @state
+ render: ->
+ R.div {},
+ "initCount: #{@props.initCount}"
+ R.br {}
+ "counter: #{@state.counter}"
+)
+
+Main = React.createClass(
+ getInitialState: ->
+ counter: 0
+ render: ->
+ R.div {},
+ Foo {initCount: @state.counter}
+ Foo {initCount: @state.counter + 1}
+)
+
+$ ->
+ main = React.renderComponent(Main(), $('.main')[0])
+ setInterval(
+ -> main.setState(counter: main.state.counter + 1)
+ 1000
+ )
Added: sandbox/trunk/src/web/react/index.jade
===================================================================
--- sandbox/trunk/src/web/react/index.jade (rev 0)
+++ sandbox/trunk/src/web/react/index.jade 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,5 @@
+doctype html
+html
+ body
+ .main
+ script(src='index.js')
Added: sandbox/trunk/src/web/react/package.json
===================================================================
--- sandbox/trunk/src/web/react/package.json (rev 0)
+++ sandbox/trunk/src/web/react/package.json 2014-03-22 20:27:47 UTC (rev 1879)
@@ -0,0 +1,22 @@
+{
+ "name": "react-experiments",
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": "",
+ "author": "",
+ "license": "BSD",
+ "dependencies": {
+ "coffee-script": "^1.7.1",
+ "coffeeify": "^0.6.0",
+ "jade": "^1.3.0",
+ "jquery": "^2.1.0",
+ "react": "^0.10.0",
+ "underscore": "^1.6.0",
+ "underscore.string": "^2.3.3",
+ "watchify": "^0.6.3"
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|