Skip to content

Instantly share code, notes, and snippets.

@arvitaly
Created September 9, 2016 18:57
Show Gist options
  • Save arvitaly/8ae581f94650d5a9369f91421641cdfa to your computer and use it in GitHub Desktop.
Save arvitaly/8ae581f94650d5a9369f91421641cdfa to your computer and use it in GitHub Desktop.
Расширение прототипа cellx
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