-
Notifications
You must be signed in to change notification settings - Fork 11
radioactive.syncify
Michal Fudala edited this page May 19, 2015
·
4 revisions
Syncify provides an easy method to transform async functions into reactive datasources.
Warning: Do not Syncify functions that Modify state! Radioactive is a read-only framework.
This is how you would normally use syncify:
var asyncFunc = function( param1, param2, callback ){ /* ... */ }
var syncifiedFunc = radioactive.syncify( asyncFunc )
radioactive.react(function(){
var result = syncifiedFunc( "param1", "param2" )
})
Or:
var syncifiedFunc = radioactive.syncify( function( param1, param2, callback ){ /* ... */ } )
radioactive.react(function(){
var result = syncifiedFunc( "param1", "param2" )
})
Some things to keep in mind:
- The async function must
- take a Node.js style callback as its last parameter
- or return a Promises/A+ compliant object ( with a
.then()
) method - The call to syncify must occur outside of any
radioactive.react
blocks
- Radioactive Tutorial
- API
- working with data
- publishing datasources
- utility
- Typescript Definition