react 0.2.5 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +189 -114
- package/doc/alternate-dsls.md +103 -0
- package/doc/default-simple.dot +19 -0
- package/doc/default-simple.dot.png +0 -0
- package/{lib → dsl}/chain.js +5 -3
- package/{lib → dsl}/fstr.js +17 -6
- package/{lib → dsl}/pcode.js +19 -8
- package/examples/chain-events1.js +28 -7
- package/examples/chain1.js +2 -2
- package/examples/default-events1.js +33 -6
- package/examples/default-log-events.js +43 -0
- package/examples/default-simple.js +45 -0
- package/examples/fstr-events1.js +4 -17
- package/examples/fstr1.js +3 -2
- package/examples/pcode1.js +2 -2
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia.html +675 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/37px-Wiktionary-logo-en.svg.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/closewindow.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/index(1).php +407 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/index.php +130 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(1).php +3 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(10).php +89 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(2).php +23 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(3).php +153 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(4).php +6 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(5).php +3 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(6).php +96 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(7).php +16 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(8).php +14 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load(9).php +123 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/load.php +3 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/poweredby_mediawiki_88x31.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/saved_resource +1 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/search-ltr.png +0 -0
- package/externalDocs/Dataflow - Wikipedia, the free encyclopedia_files/wikimedia-button.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's.html +1369 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/121911_DobbsDigest_Cover.jpg +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/160-x-600-IMU Impact 2012.jpg +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp= +68 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(1) +67 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(2) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(3) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(4) +8 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=(5) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461 +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(1) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(2) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(3) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(4) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(5) +431 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(6) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(7) +431 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(8) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/231400148;kvarticleid=231400148;kauthor=Jim Falgout;loc=100;target=_blank;grp=500202461(9) +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Ad0St1Sz6Sq0V0Id20628317.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Ad2331174St1Sz225Sq20825250V0Id4.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/AdTracImage.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/Default_Size_16_1x1.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/FB.Share +9 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/addthis_widget.js +2 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/adlink_5242_1183459_0_154_AdId=2355270;BnId=1;itime=820768810;key=231400148+_database_231400148;link= +11 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/beacon.js +7 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/checkauth.js +18 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/colorbox.css +49 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/convert_data.js +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count(1).js +5 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count.js +5 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/count.json +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dataflow1.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/def.html +126 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/defaults.css +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/detect.js +91 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/devtest_left-col-slim.css +30 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqus.js +327 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusHints.css +34 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusHints.js +8 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusLoggedOff(1).css +24 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/disqusLoggedOff.css +24 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dobbs_disqus_logo.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dsqcd10c7f376188a4a2ca3e8fea2c03aeb.css +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/dsqcd10c7f376188a4a2ca3e8fea2c03aeb.js +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/elqCfg.js +55 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/elqImg.js +12 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/embed.js +76 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/experience_util.js +636 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/fastbutton.html +11 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/ga.js +51 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-facebook_sm.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-nav.css +798 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h-twitter_sm.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/h_s_code_remote.js +377 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/hintbox_info.jpg +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/hub.1326407570.html +3 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/in.js +76 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/insight.min.js +55 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-1.2.6.min.js +32 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-1.4.2.min.js +154 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery-ui-1.8rc3.custom.min.js +374 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery.colorbox-min.js +4 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/jquery.min.js +154 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/lib.js +212 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/like.html +214 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/noavatar32.png +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/nodetag.js +18 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/nonSecureAnonymousFramework +2913 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/p.json +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/plusone.js +32 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/popwindow.js +24 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/q4OyybLB0-A.js +91 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/quant.js +28 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/qxvZoiHdpAF.css +192 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/reply.html +160 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/rss.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/s.js +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource +421 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(1) +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(2) +341 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/saved_resource(3) +127 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/script84.js +113 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/scripts.js +30 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/sh72.html +5 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shAutoloader.js +17 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushAS3.js +59 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushAppleScript.js +75 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushBash.js +59 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCSharp.js +65 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushColdFusion.js +100 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCpp.js +97 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushCss.js +91 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushDelphi.js +55 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushDiff.js +41 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushErlang.js +52 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushGroovy.js +67 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJScript.js +52 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJava.js +57 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushJavaFX.js +58 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPerl.js +72 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPhp.js +88 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPlain.js +33 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPowerShell.js +74 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushPython.js +64 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushRuby.js +55 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushSass.js +94 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushScala.js +51 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushSql.js +66 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushVb.js +56 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shBrushXml.js +69 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCore.css +226 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCoreDefault.css +333 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shCore_new.js +17 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shLegacy.js +17 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/shThemeDefault.css +117 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share-button-css +67 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share_email_icon.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/share_print_icon.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/sidebar.js +88 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/superfooter_936.css +186 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/svrGP.aspx +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/t.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/thickbox.js +343 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/thread.js +128 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/togglediv.js +15 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/tweet_button.html +3 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/ubmtechweb_logo_sm.gif +0 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/upload.html +91 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/welcome.js +7 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/widget74.css +1 -0
- package/externalDocs/Dataflow Programming Handling Huge Data Loads Without Adding Complexity Dr Dobb's_files/widgets.js +40 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia.html +904 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/50px-Question_book-new.svg.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/closewindow.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/index(1).php +407 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/index.php +130 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(1).php +3 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(10).php +89 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(2).php +23 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(3).php +153 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(4).php +6 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(5).php +3 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(6).php +96 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(7).php +16 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(8).php +14 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load(9).php +123 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/load.php +3 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/poweredby_mediawiki_88x31.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/saved_resource +1 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/search-ltr.png +0 -0
- package/externalDocs/Reactive programming - Wikipedia, the free encyclopedia_files/wikimedia-button.png +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS.html +113 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/6654_111305815684_541245684_2583159_5383291_n_normal.jpg +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/MARC3_normal.jpg +2 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/beacon.js +7 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/c953ddd239707998340e1a6fbb3eeb46 +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/c953ddd239707998340e1a6fbb3eeb46_normal.jpeg +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/clouds2_normal.jpg +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/count.json +1 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/def.html +126 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/defaults.css +1 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/disqus.js +327 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/dsq7884a9652e94555c70f96b6be63be216.css +1 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/dsq7884a9652e94555c70f96b6be63be216.js +66 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/embed.js +76 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/example1.dot +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/ga.js +51 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/get_num_replies.js +79 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/hub.1326407570.html +3 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/lib.js +212 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/noavatar32.png +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/quant.js +28 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/reply.html +160 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/t.gif +0 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/thread.js +128 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/tweet_button.1326407570.html +3 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/twitter_normal.jpg +2 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/upload.html +91 -0
- package/externalDocs/The Step of the Conductor - How To Node - NodeJS_files/widgets.js +40 -0
- package/lib/base-task.js +8 -6
- package/lib/cb-task.js +14 -1
- package/lib/core.js +43 -12
- package/lib/dsl.js +14 -6
- package/lib/event-manager.js +29 -16
- package/lib/finalcb-first-task.js +16 -10
- package/lib/finalcb-task.js +17 -10
- package/lib/input-parser.js +7 -3
- package/lib/log-events.js +71 -0
- package/lib/parse.js +6 -3
- package/lib/promise-task.js +89 -0
- package/lib/ret-task.js +1 -1
- package/lib/task.js +32 -23
- package/lib/track-tasks.js +117 -0
- package/lib/validate.js +3 -3
- package/lib/vcon.js +6 -3
- package/lib/when-task.js +81 -0
- package/package.json +5 -3
- package/promise-resolve.js +35 -0
- package/react.js +0 -4
- package/test/core-deferred.test.js +134 -0
- package/test/core-promised.test.js +132 -0
- package/test/core-when.test.js +84 -0
- package/test/core.test.js +108 -60
- package/test/dsl.test.js +58 -6
- package/test/{chain.test.js → dsl/chain.test.js} +85 -1
- package/test/{fstr.test.js → dsl/fstr.test.js} +13 -1
- package/test/{pcode.test.js → dsl/pcode.test.js} +128 -1
- package/test/exec-options.test.js +2 -1
- package/test/finalcb-task.test.js +6 -5
- package/test/input-parser.test.js +10 -6
- package/test/module-use.test.js +13 -199
- package/test/promise-auto-resolve.test.js +51 -0
- package/test/validate.test.js +5 -2
- package/test/vcon.test.js +13 -0
- package/lib/.#event-manager.js +0 -1
- package/oldExamples/analyze.js +0 -29
- package/oldExamples/analyze2.js +0 -29
- package/oldExamples/example10-dsl.js +0 -63
- package/oldExamples/example11.js +0 -62
- package/oldExamples/example12.js +0 -63
- package/oldExamples/example13.js +0 -63
- package/oldExamples/example14.js +0 -63
- package/oldExamples/example15.js +0 -75
- package/oldExamples/example6-ast.js +0 -47
- package/oldExamples/example6-dsl.js +0 -49
- package/oldExamples/example8-ast.js +0 -55
- package/oldExamples/example8-dsl.js +0 -53
- package/oldExamples/example9-ast.js +0 -58
- package/oldExamples/example9-dsl.js +0 -57
- package/oldExamples/function-str-ex1.js +0 -33
- package/oldExamples/function-str-ex2.js +0 -67
- package/oldExamples/trait1.js +0 -41
- package/oldExamples/trait2.js +0 -44
package/README.md
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# React.js
|
|
2
2
|
|
|
3
|
-
React is a javascript module to make it easier to work with asynchronous code,
|
|
4
|
-
by reducing boilerplate code and improving error and exception handling while
|
|
5
|
-
allowing variable and task dependencies when defining flow. This project is
|
|
6
|
-
applying the concepts of Reactive programming or Dataflow to controlling
|
|
7
|
-
application flow.
|
|
3
|
+
React is a javascript module to make it easier to work with asynchronous code, by reducing boilerplate code and improving error and exception handling while allowing variable and task dependencies when defining flow. This project is applying the concepts of Reactive programming or Dataflow to controlling application flow.
|
|
8
4
|
|
|
9
|
-
This async flow control module is initially designed to work with Node.js but
|
|
10
|
-
is planned to be extended to browser and other environments.
|
|
5
|
+
This async flow control module is initially designed to work with Node.js but is planned to be extended to browser and other environments.
|
|
11
6
|
|
|
12
7
|
React gets its name from similarities with how "chain reactions" work in the physical world. You start the reaction and then it cascades and continues until complete.
|
|
13
8
|
|
|
@@ -40,8 +35,8 @@ It takes inspiration from several projects including:
|
|
|
40
35
|
- object instance method calls
|
|
41
36
|
- class method calls
|
|
42
37
|
- selectFirst flow where the first task that returns defined, non-null value is used
|
|
43
|
-
-
|
|
44
|
-
-
|
|
38
|
+
- promise style functions - also automatic resolution of promise inputs (optional require('react/promise-resolve');)
|
|
39
|
+
- use of resulting flow function as callback style or promise style (if no callback provided) (provided via plugin corresponding to the promise library used)
|
|
45
40
|
- (planned) iteration on arrays, streams, sockets
|
|
46
41
|
- (planned) event emitter integration
|
|
47
42
|
|
|
@@ -49,7 +44,8 @@ The tasks can be mixed, meaning you can use async, sync, object method calls, cl
|
|
|
49
44
|
|
|
50
45
|
## Concept
|
|
51
46
|
|
|
52
|
-
Borrowing heavily from Tim and Elijah's ideas for conductor, this async flow control module provides a way to construct a flow from a
|
|
47
|
+
Borrowing heavily from Tim and Elijah's ideas for conductor, this async flow control module provides a way to construct a flow from a
|
|
48
|
+
collection of rules based on functions or methods (referred to as _tasks_ in this module). It allows dependencies to be defined between the tasks so they can run in parallel as their dependencies are satisfied. React can us both variable dependencies and task dependencies.
|
|
53
49
|
|
|
54
50
|
As tasks complete, React watches the dependencies and kicks off additional tasks that have all their dependencies met and are ready to execute. This allows the flow to run at maximum speed without needing to arbitrarily block tasks into groups of parallel and serial flow.
|
|
55
51
|
|
|
@@ -57,11 +53,12 @@ To reduce the boilerplate code needed and improve error handling, React automati
|
|
|
57
53
|
|
|
58
54
|
1. check for error and handle by calling outer callback function with this error after augmenting it with additional context information for easier debugging
|
|
59
55
|
2. save the callback variables into a context for future reference
|
|
60
|
-
3. call back into React (and it will kick off additional tasks that
|
|
56
|
+
3. call back into React (and it will kick off additional tasks that are now ready to go)
|
|
57
|
+
4. Using the dependencies specified for each
|
|
61
58
|
|
|
62
59
|
## Design
|
|
63
60
|
|
|
64
|
-
- Parse and validate DSL rules at module load time
|
|
61
|
+
- Parse and validate DSL rules at module load time creating AST
|
|
65
62
|
- Validate the flow AST at module load time - determine if dependencies can all be met as defined
|
|
66
63
|
- Execute the flow AST by calling the function with arguments
|
|
67
64
|
|
|
@@ -75,11 +72,10 @@ Pull from github - http://github.com/jeffbski/react
|
|
|
75
72
|
|
|
76
73
|
## Examples
|
|
77
74
|
|
|
78
|
-
1. [
|
|
79
|
-
2. [
|
|
80
|
-
3. [Using pseudocode DSL](#pcode)
|
|
81
|
-
4. [Using jquery-like chaining DSL](#chain)
|
|
75
|
+
1. [Direct AST](#directAST)
|
|
76
|
+
2. [Default DSL](#defaultDSL)
|
|
82
77
|
|
|
78
|
+
### Example using the default DSL
|
|
83
79
|
|
|
84
80
|
These live in the examples folder so they are ready to run.
|
|
85
81
|
Also see test/module-use.test.js for more examples as well
|
|
@@ -88,40 +84,63 @@ as the specific tests for the DSL you want to use.
|
|
|
88
84
|
<a name="defaultDSL"/>
|
|
89
85
|
### Example using default DSL
|
|
90
86
|
|
|
87
|
+
- Simple example showing flow definition of two async functions feeding a
|
|
88
|
+
synchronous function.
|
|
89
|
+
|
|
90
|
+
- First two async functions inputs are satisfied by the flow inputs, so
|
|
91
|
+
they will both run immediately in parallel.
|
|
92
|
+
|
|
93
|
+
- The last function waits for the outputs of the previous ones, then
|
|
94
|
+
executes synchronously.
|
|
95
|
+
|
|
96
|
+
- Finally the flow calls the callback with the output values once all
|
|
97
|
+
the tasks have completed.
|
|
98
|
+
|
|
91
99
|
```javascript
|
|
92
|
-
// in your
|
|
100
|
+
// in your foobar module
|
|
93
101
|
var react = require('react');
|
|
94
102
|
|
|
95
103
|
// some normal async and sync functions
|
|
96
|
-
function
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
function
|
|
104
|
+
function loadFoo(fooPath, cb) {
|
|
105
|
+
setTimeout(function () {
|
|
106
|
+
cb(null, [fooPath, 'data'].join(':'));
|
|
107
|
+
}, 10);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function loadBar(barPath, barP2, cb) {
|
|
111
|
+
setTimeout(function () {
|
|
112
|
+
cb(null, [barPath, barP2, 'data'].join(':'));
|
|
113
|
+
}, 10);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function render(foo, bar) {
|
|
117
|
+
return ['<html>', foo, '/', bar, '</html>'].join('');
|
|
118
|
+
}
|
|
103
119
|
|
|
104
120
|
// define fn, glue together with react, it will parallelize
|
|
105
121
|
// starts with name and in/out params, then the tasks
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
writeOutput, 'html, user, cb -> err, htmlBytesWritten',
|
|
111
|
-
loadEmailTemplate, 'cb -> err, emailmd',
|
|
112
|
-
markdown, 'emailmd -> emailHtml', // no cb, implies sync fn
|
|
113
|
-
customizeEmail, 'user, emailHtml, cb -> err, custEHtml',
|
|
114
|
-
deliverEmail, 'custEHtml, cb -> err, custBytesWritten'
|
|
122
|
+
var loadRender = react('loadRender', 'fooPath, barPath, barP2, cb -> err, renderedOut',
|
|
123
|
+
loadFoo, 'fooPath, cb -> err, foo', // async cb function
|
|
124
|
+
loadBar, 'barPath, barP2, cb -> err, bar', // async cb function
|
|
125
|
+
render, 'foo, bar -> renderedOut' // sync function using outputs from first two
|
|
115
126
|
);
|
|
116
|
-
|
|
127
|
+
|
|
128
|
+
exports.loadRender = loadRender; // is a normal fn created by react
|
|
129
|
+
|
|
117
130
|
|
|
118
131
|
// in a different module far far away, use this as any other node function
|
|
119
|
-
var
|
|
120
|
-
foo.
|
|
121
|
-
// tasks were parallelized based on their
|
|
122
|
-
|
|
132
|
+
var foobar = require('foobar');
|
|
133
|
+
foobar.loadRender('foo.txt', 'bar.txt', 'BBB', function (err, renderedOut) {
|
|
134
|
+
// tasks in loadRender were parallelized based on their input dependencies
|
|
135
|
+
console.error('results:', renderedOut);
|
|
136
|
+
});
|
|
123
137
|
```
|
|
124
138
|
|
|
139
|
+
Below is a graph of how the dependencies are mapped by React which
|
|
140
|
+
also indicates how the tasks will be executed
|
|
141
|
+
|
|
142
|
+

|
|
143
|
+
|
|
125
144
|
|
|
126
145
|
<a name="directAST"/>
|
|
127
146
|
### Example directly using AST
|
|
@@ -153,95 +172,147 @@ fn('foo', 'pre-', '-post', function cb(err, lres) {
|
|
|
153
172
|
});
|
|
154
173
|
```
|
|
155
174
|
|
|
156
|
-
|
|
157
|
-
|
|
175
|
+
### Alternate interfaces (DSL's)
|
|
176
|
+
|
|
177
|
+
1. [Using pseudocode DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#pcode)
|
|
178
|
+
2. [Using jquery-like chaining DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#chain)
|
|
179
|
+
3. [Using function string DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#fstr)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## User API
|
|
183
|
+
|
|
184
|
+
### Default DSL
|
|
185
|
+
|
|
186
|
+
The main function returned from require('react') can be used to define the AST used for the processing of the rules or flow.
|
|
187
|
+
|
|
188
|
+
It takes the following arguments to define a flow function:
|
|
158
189
|
|
|
159
190
|
```javascript
|
|
160
191
|
var react = require('react');
|
|
192
|
+
var fn = react('my-flow-name', 'paramName1, paramName2, cb -> err, outParamName1, outParamName2',
|
|
193
|
+
functionRefOrMethodStr, 'paramName1, cb -> err, outParamName2', // async cb task
|
|
194
|
+
functionRefOrMethodStr2, 'paramName2, paramName1 -> outParamName1' // sync task
|
|
195
|
+
);
|
|
196
|
+
```
|
|
161
197
|
|
|
162
|
-
function
|
|
163
|
-
function
|
|
164
|
-
|
|
165
|
-
function
|
|
166
|
-
function
|
|
167
|
-
|
|
168
|
-
function
|
|
169
|
-
function
|
|
170
|
-
|
|
171
|
-
function useHtml(err, html, user, bytesWritten) {
|
|
172
|
-
if(err) {
|
|
173
|
-
console.log('***Error: %s', err);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
console.log('final result: %s, user: %s, written:%s', html, user, bytesWritten);
|
|
177
|
-
}
|
|
198
|
+
1. **flow/function name** - string - represents the name of the flow or function that will be created. React will use the name when generating events so you can monitor progress and performance and also when errors occur.
|
|
199
|
+
2. **in/out flow parameter definition** - string - the inputs and outputs for the flow function. The parameters are specified in one single string for easy typing, separated by commas. The output follows the input after being separated by a `->`. Use the parameter name `cb` or `callback` to specify the Node style callback and `err` to represent the error parameter as the first output parameter of the callback. Literal values can also be specified directly (true, false, numbers, this, null). Literal strings can simply be quoted using single or double quotes.
|
|
200
|
+
3. **optional flow options** - object - If an object is provided immediately after the in/out flow def, then these options will be provided to react to customize the flow. This is reserved for future use.
|
|
201
|
+
3. **function reference or method string** - Specify the function to be called for this task, or if calling a method off of an object being passed in or returned by a task, use a string to specify like `'obj.method'`. These can be asynchronous Node-style callback `cb(err, ...)` functions or synchronous functions which simply return values directly.
|
|
202
|
+
4. **in/out task parameter definition** - string - similar to the in/out flow parameter definition above, these are the inputs and outputs that are passed to a task function and returned from a task function. The inputs will need to match either those from the flow inputs or outputs from other tasks that will run before this task. React will use the inputs as dependencies, so it will invoke and wait for response from the tasks that provide the dependent inputs. So simply by specifying inputs and outputs for the tasks, React will prioritize and parallelize tasks to run as fast as possible. Use `cb` or `callback` along with `err` to specify asynchronous Node style `cb(err, ...)` task, or omit both to specify a synchronous task.A synchronous task can only have a single return parameter.
|
|
203
|
+
5. **optional task options** - object - if an object is provided this can be used to specify additional options for this task. Currently the valid options for a task are:
|
|
204
|
+
- **name** - string - specifies a name for a task, otherwise React will try to use the function name or method string if it is unique in the flow. If a name is not unique subsequent tasks will have `_index` (zero based index of the task) added to create unique name. If you specify a name, you will also want to indicate a unique name for within the flow otherwise it will get a suffix as well. Example: `{ name: 'myTaskName' }`
|
|
205
|
+
- **after** - string, function reference, or array of string or function refs - specify additional preconditions that need to be complete before this task can run. In addition to the input dependencies being met, wait for these named tasks to complete before running. The preconditions are specified using the name of the task or if the task function was only used once and is a named function (not anonymous), you can just provide the function reference and it will determine name from it. Example: `{ after: 'foo' }` or `{ after: ['foo', 'bar'] }`
|
|
206
|
+
6. **repeat 3-5** - repeat steps 3-5 to specify additional tasks in this flow. As dependencies are met for tasks, React will invoke additional tasks that are ready to run in the order they are defined in this flow definition. So while the order does have some influence on the execution, it is primarily defined by the input dependencies and any other additonal preconditions specified with the `after` option. If you want to guarantee that something only runs after something else completes, then it will need to use an output from that task or specify the dependency with an `after`.
|
|
178
207
|
|
|
179
|
-
var loadAndSave = react.fstrDefine('filename, uid, outDirname, cb', [ // input params
|
|
180
|
-
loadUser, 'uid -> err, user', // calling async fn loadUser with uid, callback is called with err and user
|
|
181
|
-
loadFile, 'filename -> err, filedata',
|
|
182
|
-
markdown, 'filedata -> returns html', // using a sync function
|
|
183
|
-
prepareDirectory, 'outDirname -> err, dircreated',
|
|
184
|
-
writeOutput, 'html, user -> err, bytesWritten', { after: prepareDirectory }, // only after prepareDirectory done
|
|
185
|
-
loadEmailTemplate, ' -> err, emailmd',
|
|
186
|
-
markdown, 'emailmd -> returns emailHtml', // using a sync function
|
|
187
|
-
customizeEmail, 'user, emailHtml -> returns custEmailHtml',
|
|
188
|
-
deliverEmail, 'custEmailHtml -> err, deliveredEmail', { after: writeOutput } // only after writeOutput is done
|
|
189
|
-
], 'err, html, user, bytesWritten'); // callback output params
|
|
190
|
-
|
|
191
|
-
loadAndSave('file.md', 100, '/tmp/foo', useHtml); // executing the flow
|
|
192
|
-
```
|
|
193
208
|
|
|
194
|
-
|
|
195
|
-
|
|
209
|
+
The flow function created by react from the input definition is a normal Node-style function which can be used like any other. These flow functions can be defined in a module and exported, they can be passed into other functions, used as methods on objects (the `this` context is passed in and available).
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### AST
|
|
213
|
+
|
|
214
|
+
The abstract syntax tree or AST provided by React represents the data necessary to define the flow. By abstracting this from the DSL, it allows new skins or interfaces to be developed without need to change the core engine.
|
|
215
|
+
|
|
216
|
+
The AST is normally created at parse time when the React main function is called (or one of the alternate DSL's is called). This can be done a module load time such that after loading the React defined flow function's AST is generated and ready to process eliminating parsing and validation overhead when it is invoked in the future. This has the added advantage that since validation has also been performed that additional syntax issues or incomplete flow defintion errors can be caught quickly.
|
|
217
|
+
|
|
218
|
+
After the flow function has been created, you can review the generated AST for a function by accessing the ast.
|
|
196
219
|
|
|
197
220
|
```javascript
|
|
198
221
|
var react = require('react');
|
|
222
|
+
var fn = react('my-flow-name', 'paramName1, paramName2, cb -> err, outParamName1, outParamName2',
|
|
223
|
+
functionRefOrMethodStr, 'paramName1, cb -> err, outParamName2', // async cb task
|
|
224
|
+
functionRefOrMethodStr2, 'paramName2, paramName1 -> outParamName1' // sync task
|
|
225
|
+
);
|
|
199
226
|
|
|
200
|
-
|
|
201
|
-
function add(a, b) { return a + b; }
|
|
202
|
-
var locals = { // since pcodeDefine uses strings, need references to functions passed into react
|
|
203
|
-
multiply: multiply,
|
|
204
|
-
add: add
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
var fn = react.pcodeDefine('a, b, cb', [ // input params
|
|
208
|
-
'm := multiply(a, b)', // using a callback function, use :=
|
|
209
|
-
's = add(m, a)', // using a sync function, use =
|
|
210
|
-
'cb(err, m, s)' // output params for final callback
|
|
211
|
-
], locals); // hash of functions that will be used
|
|
212
|
-
|
|
213
|
-
fn(2, 3, function (err, m, s) {
|
|
214
|
-
console.error('err:', err); // null
|
|
215
|
-
console.error('m:', m); // 2 * 3 = 6
|
|
216
|
-
console.error('s:', s); // 6 + 2 = 8
|
|
217
|
-
});
|
|
227
|
+
console.error(fn.ast); // output the generated AST
|
|
218
228
|
```
|
|
219
229
|
|
|
220
|
-
|
|
221
|
-
### Example using jquery-like chaining DSL interface
|
|
230
|
+
The AST contains the following pieces:
|
|
222
231
|
|
|
223
232
|
```javascript
|
|
224
|
-
var
|
|
233
|
+
var ast = {
|
|
234
|
+
name: flowName,
|
|
235
|
+
inParams: [],
|
|
236
|
+
tasks: [],
|
|
237
|
+
outTask: {},
|
|
238
|
+
locals: {}
|
|
239
|
+
};
|
|
240
|
+
```
|
|
241
|
+
- **name** - string - represents the name of the flow or function that will be created. React will use the name when generating events so you can monitor progress and performance and also when errors occur.
|
|
242
|
+
- **inParams** - array of strings - the flow input parameter names (excluding the callback param)
|
|
243
|
+
- **tasks** - array of task defintion objects - each containing:
|
|
244
|
+
- **f** - function reference or method string - async or sync function to be used for this task
|
|
245
|
+
- **a** - array of input parameter names (excluding the callback param)
|
|
246
|
+
- **out** - array of output parameter names (excluding the err parame)
|
|
247
|
+
- **type** - type of function determining how function is invoked and its output style - one of: ('cb', 'ret', 'promise', 'when')
|
|
248
|
+
- **name** - string - unique name for each task provided or generated by React
|
|
249
|
+
- **outTask** - task definition object specifying the flow's output style and parameters containing:
|
|
250
|
+
- **f** - will contain reference to the callback function at runtime
|
|
251
|
+
- **a** - parameters being passed as output from the flow
|
|
252
|
+
- **locals** - object provided which contains additional values that will become part of the React variable space like input parameters but can be defined in advance at flow definition. This can be used to provide functions and objects to React enabling string based DSL's like the pcode DSL can be utilized.
|
|
225
253
|
|
|
226
|
-
function multiply(a, b, cb) { cb(null, a * b); }
|
|
227
|
-
function add(a, b) { return a + b; }
|
|
228
254
|
|
|
229
|
-
|
|
230
|
-
.in('a', 'b', 'cb') // input params
|
|
231
|
-
.out('err', 'm', 's') // final callback output params
|
|
232
|
-
.async(multiply).in('a', 'b', 'cb').out('err', 'm') // task def - async fn, in params, callback out params
|
|
233
|
-
.sync(add).in('m', 'a').out('s') // task def - sync fn, in params, return value
|
|
234
|
-
.end();
|
|
255
|
+
### Plugins (optional requires which turn on additional functionality)
|
|
235
256
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
257
|
+
Additional functionality which is not enabled by default but available by requiring additional modules.
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
#### LogEvents - log react progress to stderr
|
|
261
|
+
|
|
262
|
+
For convenience in debugging or in monitoring flow and performance, React has a built-in plugin for easily logging progress to stderr which is activiated by requiring it and specifying a particular flow function to log or use the main react for global logging of all react modules.
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
require('react/lib/log-events').logEvents(react); // turn on logging for all react functions
|
|
266
|
+
|
|
267
|
+
// OR
|
|
268
|
+
|
|
269
|
+
require('react/lib/log-events').logEvents(myReactFn); // turn on logging for a specific function, repeat for other functions as needed
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### Automatic Promise Resolution for inputs
|
|
273
|
+
|
|
274
|
+
If you want to automatically resolve promises in React without having to manually call `when` or `then`, React provides a plugin which will detect the existence of a `then` method (indicating a promise) at runtime from any inputs to the flow and will internally create `when` tasks to resolve them before passing the values to other tasks.
|
|
275
|
+
|
|
276
|
+
```javascript
|
|
277
|
+
require('react/promise-resolve');
|
|
241
278
|
```
|
|
242
279
|
|
|
280
|
+
#### Track tasks
|
|
281
|
+
|
|
282
|
+
Instead of only logging events to stderr (like LogEvents), this plugin fires events that can be directly monitored. The LogEvent plugin uses this internally to get access to the metrics.
|
|
283
|
+
|
|
284
|
+
It also provides a simple accumulator which can be used to accumulate events. Note that this accumulator is designed for short term debug use, as it will continue to accumulate events and does not have any size restrictions.
|
|
285
|
+
|
|
286
|
+
Thus while the tracking can be used in production because it simply fires events, the accumulator should only be used for convenience in debugging and testing.
|
|
287
|
+
|
|
288
|
+
```javascript
|
|
289
|
+
require('react/lib/track-tasks'); // enable tracking and events
|
|
290
|
+
|
|
291
|
+
// if you want to use the accumulator
|
|
292
|
+
|
|
293
|
+
var EventCollector = require('react/lib/track-tasks').EventCollector;
|
|
294
|
+
var collector = new EventCollector();
|
|
295
|
+
|
|
296
|
+
collector.captureGlobal('*'); // capture all react events for all flows
|
|
297
|
+
|
|
298
|
+
// OR
|
|
299
|
+
|
|
300
|
+
collector.capture(flowFn, 'task.'); // capture task events on a flow
|
|
301
|
+
collector.capture(flowFn, 'flow.'); // add capture flow events on a flow
|
|
302
|
+
|
|
303
|
+
var events = collector.list(); // retrieve the list of events
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
#### Alternate DSL's
|
|
307
|
+
|
|
308
|
+
Additional DSL's can be loaded by requiring them. See the [Alternate DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md) page for more info.
|
|
309
|
+
|
|
310
|
+
|
|
243
311
|
## Status
|
|
244
312
|
|
|
313
|
+
- 2012-01-17 - Additional documentation (v0.3.5)
|
|
314
|
+
- 2012-01-16 - Refine events and create logging plugin (v0.3.3)
|
|
315
|
+
- 2012-01-13 - Add promise tasks, promise resolution, refactor alternate DSL interfaces as optional requires (v0.3.0)
|
|
245
316
|
- 2012-01-11 - Provide warning/error when name is skipped in default DSL, literal check in validate (v0.2.5)
|
|
246
317
|
- 2012-01-10 - Create default DSL for react(), create error for missing variables, list remaining tasks when flow won't complete
|
|
247
318
|
- 2011-12-21 - Refactor from ground up with tests, changes to the interfaces
|
|
@@ -252,23 +323,27 @@ fn(2, 3, function (err, m, s) {
|
|
|
252
323
|
```bash
|
|
253
324
|
ok ast.test.js .................... 10/10
|
|
254
325
|
ok cb-task.test.js ................ 31/31
|
|
255
|
-
ok
|
|
256
|
-
ok core.test.js
|
|
257
|
-
ok
|
|
326
|
+
ok core-deferred.test.js .......... 11/11
|
|
327
|
+
ok core-promised.test.js .......... 11/11
|
|
328
|
+
ok core-when.test.js ................ 6/6
|
|
329
|
+
ok core.test.js ................. 104/104
|
|
330
|
+
ok chain.test.js .................. 74/74
|
|
331
|
+
ok fstr.test.js ................... 67/67
|
|
332
|
+
ok pcode.test.js .................. 94/94
|
|
333
|
+
ok dsl.test.js .................... 70/70
|
|
258
334
|
ok event-manager.test.js .......... 13/13
|
|
259
335
|
ok exec-options.test.js ............. 3/3
|
|
260
336
|
ok finalcb-task.test.js ............. 5/5
|
|
261
|
-
ok fstr.test.js ................... 64/64
|
|
262
337
|
ok input-parser.test.js ........... 15/15
|
|
263
|
-
ok module-use.test.js .............
|
|
264
|
-
ok
|
|
338
|
+
ok module-use.test.js ............. 21/21
|
|
339
|
+
ok promise-auto-resolve.test.js ..... 4/4
|
|
265
340
|
ok ret-task.test.js ............... 31/31
|
|
266
341
|
ok task.test.js ..................... 1/1
|
|
267
342
|
ok validate-cb-task.test.js ......... 6/6
|
|
268
343
|
ok validate-ret-task.test.js ........ 7/7
|
|
269
344
|
ok validate.test.js ............... 31/31
|
|
270
|
-
ok vcon.test.js ...................
|
|
271
|
-
total ...........................
|
|
345
|
+
ok vcon.test.js ................... 55/55
|
|
346
|
+
total ........................... 692/692
|
|
272
347
|
|
|
273
348
|
ok
|
|
274
349
|
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Alternate DSL's
|
|
2
|
+
|
|
3
|
+
These DSL's are not loaded by default and thus require a separate require if you want to use one.
|
|
4
|
+
|
|
5
|
+
Since React is an AST based rules system, it allows custom DSL's to be created easily, they only need to generate the AST and they are fully functional, allowing many different interfaces for the same system.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Examples using the AST directly or alternate DSL's
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
1. [Using pseudocode DSL](#pcode)
|
|
12
|
+
2. [Using jquery-like chaining DSL](#chain)
|
|
13
|
+
3. [Function String DSL](#fstr) (Deprecated)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<a name="pcode"/>
|
|
17
|
+
### Example using pseudocode DSL interface
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
var pcodeDefine = require('react/dsl/pcode');
|
|
21
|
+
|
|
22
|
+
function multiply(a, b, cb) { cb(null, a * b); }
|
|
23
|
+
function add(a, b) { return a + b; }
|
|
24
|
+
var locals = { // since pcodeDefine uses strings, need references to functions passed into react
|
|
25
|
+
multiply: multiply,
|
|
26
|
+
add: add
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var fn = pcodeDefine('a, b, cb', [ // input params
|
|
30
|
+
'm := multiply(a, b)', // using a callback function, use :=
|
|
31
|
+
's = add(m, a)', // using a sync function, use =
|
|
32
|
+
'cb(err, m, s)' // output params for final callback
|
|
33
|
+
], locals); // hash of functions that will be used
|
|
34
|
+
|
|
35
|
+
fn(2, 3, function (err, m, s) {
|
|
36
|
+
console.error('err:', err); // null
|
|
37
|
+
console.error('m:', m); // 2 * 3 = 6
|
|
38
|
+
console.error('s:', s); // 6 + 2 = 8
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
<a name="chain"/>
|
|
43
|
+
### Example using jquery-like chaining DSL interface
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
var chainDefine = require('react/dsl/chain');
|
|
47
|
+
|
|
48
|
+
function multiply(a, b, cb) { cb(null, a * b); }
|
|
49
|
+
function add(a, b) { return a + b; }
|
|
50
|
+
|
|
51
|
+
var fn = chainDefine()
|
|
52
|
+
.in('a', 'b', 'cb') // input params
|
|
53
|
+
.out('err', 'm', 's') // final callback output params
|
|
54
|
+
.async(multiply).in('a', 'b', 'cb').out('err', 'm') // task def - async fn, in params, callback out params
|
|
55
|
+
.sync(add).in('m', 'a').out('s') // task def - sync fn, in params, return value
|
|
56
|
+
.end();
|
|
57
|
+
|
|
58
|
+
fn(2, 3, function (err, m, s) {
|
|
59
|
+
console.error('err:', err); // null
|
|
60
|
+
console.error('m:', m); // 2 * 3 = 6
|
|
61
|
+
console.error('s:', s); // 6 + 2 = 8
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
<a name="fstr"/>
|
|
66
|
+
### Example using Function String DSL interface
|
|
67
|
+
|
|
68
|
+
The Function String DSL interface is deprecated since it morphed into the default DSL which is very similar. It is recommended that you use the default DSL instead.
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
var fstrDefine = require('react/dsl/fstr');
|
|
72
|
+
|
|
73
|
+
function loadUser(uid, cb){ setTimeout(cb, 100, null, "User"+uid); }
|
|
74
|
+
function loadFile(filename, cb){ setTimeout(cb, 100, null, 'Filedata'+filename); }
|
|
75
|
+
function markdown(filedata) { return 'html'+filedata; }
|
|
76
|
+
function prepareDirectory(outDirname, cb){ setTimeout(cb, 200, null, 'dircreated-'+outDirname); }
|
|
77
|
+
function writeOutput(html, user, cb){ setTimeout(cb, 300, null, html+'_bytesWritten'); }
|
|
78
|
+
function loadEmailTemplate(cb) { setTimeout(cb, 50, null, 'emailmd'); }
|
|
79
|
+
function customizeEmail(user, emailHtml, cb) { return 'cust-'+user+emailHtml; }
|
|
80
|
+
function deliverEmail(custEmailHtml, cb) { setTimeout(cb, 100, null, 'delivered-'+custEmailHtml); }
|
|
81
|
+
|
|
82
|
+
function useHtml(err, html, user, bytesWritten) {
|
|
83
|
+
if(err) {
|
|
84
|
+
console.log('***Error: %s', err);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
console.log('final result: %s, user: %s, written:%s', html, user, bytesWritten);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var loadAndSave = fstrDefine('filename, uid, outDirname, cb', [ // input params
|
|
91
|
+
loadUser, 'uid -> err, user', // calling async fn loadUser with uid, callback is called with err and user
|
|
92
|
+
loadFile, 'filename -> err, filedata',
|
|
93
|
+
markdown, 'filedata -> returns html', // using a sync function
|
|
94
|
+
prepareDirectory, 'outDirname -> err, dircreated',
|
|
95
|
+
writeOutput, 'html, user -> err, bytesWritten', { after: prepareDirectory }, // only after prepareDirectory done
|
|
96
|
+
loadEmailTemplate, ' -> err, emailmd',
|
|
97
|
+
markdown, 'emailmd -> returns emailHtml', // using a sync function
|
|
98
|
+
customizeEmail, 'user, emailHtml -> returns custEmailHtml',
|
|
99
|
+
deliverEmail, 'custEmailHtml -> err, deliveredEmail', { after: writeOutput } // only after writeOutput is done
|
|
100
|
+
], 'err, html, user, bytesWritten'); // callback output params
|
|
101
|
+
|
|
102
|
+
loadAndSave('file.md', 100, '/tmp/foo', useHtml); // executing the flow
|
|
103
|
+
```
|