File tree Expand file tree Collapse file tree 4 files changed +133
-1
lines changed Expand file tree Collapse file tree 4 files changed +133
-1
lines changed Original file line number Diff line number Diff line change 1- * .js
21output
32bower_components
43node_modules
Original file line number Diff line number Diff line change 1+ /* global exports */
2+ "use strict" ;
3+
4+ // module React
5+
6+ exports . getProps = function ( ctx ) {
7+ return function ( ) {
8+ return ctx . props ;
9+ } ;
10+ } ;
11+
12+ exports . getRefs = function ( ctx ) {
13+ return function ( ) {
14+ return ctx . refs ;
15+ } ;
16+ } ;
17+
18+ exports . writeState = function ( ctx ) {
19+ return function ( state ) {
20+ return function ( ) {
21+ ctx . replaceState ( {
22+ state : state
23+ } ) ;
24+ return function ( ) {
25+ return state ;
26+ }
27+ } ;
28+ } ;
29+ } ;
30+
31+ exports . readState = function ( ctx ) {
32+ return function ( ) {
33+ return ctx . state . state ;
34+ } ;
35+ } ;
36+
37+ exports . mkUI = function ( ss ) {
38+ return function ( render ) {
39+ var specs = { } ;
40+ for ( var s in ss ) {
41+ if ( ss . hasOwnProperty ( s ) ) {
42+ specs [ s ] = ( function ( impl ) {
43+ return function ( ) {
44+ return impl ( this ) ( ) ;
45+ }
46+ } ) ( ss [ s ] ) ;
47+ }
48+ }
49+ specs . getInitialState = function ( ) {
50+ return {
51+ state : ss . getInitialState ( this ) ( )
52+ } ;
53+ } ;
54+ specs . render = function ( ) {
55+ return render ( this ) ( ) ;
56+ } ;
57+ return React . createClass ( specs ) ;
58+ }
59+ } ;
60+
61+ exports . handle = function ( f ) {
62+ return function ( e ) {
63+ return f ( e ) ( ) ;
64+ } ;
65+ } ;
66+
67+ exports . renderToString = React . renderComponentToString ;
68+
69+ exports . renderToBody = function ( component ) {
70+ return function ( ) {
71+ return React . renderComponent ( component , document . body ) ;
72+ }
73+ } ;
74+
75+ exports . renderToElementById = function ( id ) {
76+ return function ( component ) {
77+ return function ( ) {
78+ return React . renderComponent ( component , document . getElementById ( id ) ) ;
79+ }
80+ }
81+ } ;
Original file line number Diff line number Diff line change 1+ /* global exports */
2+ "use strict" ;
3+
4+ // module React.DOM
5+
6+ function mkProps ( props ) {
7+ var result = { } ;
8+ for ( var i = 0 , len = props . length ; i < len ; i ++ ) {
9+ var prop = props [ i ] ;
10+ var name = prop . constructor . name ;
11+ name = name [ 0 ] . toLowerCase ( ) + name . substring ( 1 ) ;
12+ var val = prop . value0 ;
13+ /* Until React.js handles data and aria like style*/
14+ /* we have to unload the properties.*/
15+ if ( name === 'data' || name === 'aria' ) {
16+ for ( var subprop in val ) {
17+ if ( val . hasOwnProperty ( subprop ) ) {
18+ result [ name + '-' + subprop ] = val [ subprop ] ;
19+ }
20+ }
21+ } else {
22+ result [ name ] = val ;
23+ }
24+ }
25+ return result ;
26+ } ;
27+
28+ exports . mkDOM = function ( tagName ) {
29+ var ctor = window . React . DOM [ tagName ] ;
30+ return function ( props ) {
31+ return function ( children ) {
32+ var p = props . length > 0 ? mkProps ( props ) : null ;
33+ return ctor . apply ( ctor , [ p ] . concat ( children ) ) ;
34+ }
35+ }
36+ } ;
37+
38+ exports . text = function ( text ) {
39+ return text ;
40+ } ;
Original file line number Diff line number Diff line change 1+ /* global exports */
2+ "use strict" ;
3+
4+ // module Test.Main
5+
6+ exports . interval = function ( ms ) {
7+ return function ( action ) {
8+ return function ( ) {
9+ return setInterval ( action , ms ) ;
10+ }
11+ }
12+ } ;
You can’t perform that action at this time.
0 commit comments