Created
September 9, 2016 18:57
-
-
Save arvitaly/8ae581f94650d5a9369f91421641cdfa to your computer and use it in GitHub Desktop.
Расширение прототипа cellx
This file contains hidden or 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
var cellx = require('cellx'); | |
var x = new cellx.Cell | |
cellx.Cell.prototype.if = function (trueCondition) { | |
this.subscribe(function () { | |
this.get() && trueCondition() | |
}); | |
this.get() && trueCondition() | |
} | |
x.if(() => { | |
console.log('x is truthy') | |
}) | |
x.set(false); | |
setTimeout(() => { | |
x.set(true); | |
}, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment