#RxJS 5 Operators By Example A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
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
// Use https://astexplorer.net/ | |
export default function transformer(file, api) { | |
const j = api.jscodeshift; | |
const root = j(file.source); | |
const gulpTaskCalls = root.find(j.CallExpression, { | |
callee: { | |
object: { | |
name: 'gulp' |
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
// A more straight forward es5 version | |
function resolveOn(eventEmmiter, resolveEvent, rejectEvent) { | |
rejectEvent = rejectEvent === undefined ? "error" : rejectEvent; | |
return new Promise(function(resolve, reject) { | |
function resolveHandler(value) { | |
eventEmmiter.removeListener(rejectEvent, rejectHandler); | |
resolve(value); | |
} |
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
// Based on http://blog.victorquinn.com/javascript-promise-while-loop and https://github.com/stevenzeiler/promise-while | |
function promiseWhile(condition, action) { | |
return new Promise((resolve, reject) => { | |
const loop = () => | |
Promise.resolve(condition()) | |
.then(keepGoing => { | |
if (!keepGoing) { return resolve(); } |
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
var Rx = require('rx') | |
/** | |
* RxFixedInterval | |
* | |
* Returns an observable sequence that produces a value after each period. | |
* | |
* The difference between FixedInterval and the standard Rx interval is each value is produced when the time | |
* is divisable by the interval. | |
* |
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
//- For use with https://github.com/CREEATION/laravel-elixir-jade | |
mixin blade() | |
='\r\n' | |
block | |
='\r\n' | |
mixin phpblock() | |
!='\r\n<?php ' |