Last active
August 2, 2017 13:07
-
-
Save gonaumov/e209b82ae2bccd0a4da4e6bdbac83e4b to your computer and use it in GitHub Desktop.
task queue mechanism
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
this.streamOne = Bacon.fromBinder(function (sink) { | |
sink(new Bacon.Next()); | |
}).filter(function () { | |
return sessionStorage.getItem('somethingExist') !== null && sessionStorage.getItem('somethingExist') === 'true'; | |
}).toProperty(); | |
// I noticed that it not works at all when I missed this | |
// The question is why? :( | |
this.streamOne.onValue(function () { | |
sessionStorage.removeItem('somethingExist'); | |
}); | |
this.streamTwo = new Bacon.Bus(); | |
this.streamTwo.filter(function () { | |
// there is condition here .. | |
return true; | |
}).flatMapConcat(function (task) { | |
return self.streamOne.take(1).map(task); | |
}).onValue(function (data) { | |
console.log('do something'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment