Last active
January 17, 2017 04:17
-
-
Save axefrog/2442f367c623f8e5d5b525232cc733cd to your computer and use it in GitHub Desktop.
A cleaner abstraction for creating and resolving stream proxies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {using} from 'proxy-abstraction'; | |
function render() { | |
// The `using` function takes a callback function. It looks at the functions `.length` property | |
// and generates a proxy for each. You then return a tuple containing the value you want to | |
// persist, and fulfillment streams for each of the referenced proxies. The using function will | |
// automatically complete the proxies internally and return the first tuple argument. | |
return using((click$, hover$) => { | |
const view = div(......); | |
return [ | |
view, | |
view.events.click, | |
view.events.mouseOver | |
]; | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment