用例子讲解 RxJS 5 的 Operators 。
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 { createStore, applyMiddleware } from 'redux'; | |
import { Observable, Subject } from 'rxjs'; | |
const api = type => { | |
console.log(`calling API ${type}`); | |
return new Promise(res => setTimeout(() => res(), 500)); | |
}; | |
const actionOrder = (actions, order) => actions.every((action, index) => action.type === order[index]); | |
const actionPredicate = actions => filterableAction => actions.some(action => action === filterableAction.type); |
This listens to Angular route changes and on route change does the following:
- Replaces the link in
<use xlink:href="#some-id"></use>
by a path prefixed version - Replaces the fill property in referenced SVGs by a path prefixed version
- Replaces the style in
<svg style="fill: url(#gradient)">
with a prefixed version
Adapted from Gist by Leon Derijke