A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
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
| module Particle exposing (..) | |
| import Array | |
| import Task | |
| import Html.App as App | |
| import Window exposing (Size, resizes) | |
| import Color exposing (Color, black, white, rgba) | |
| import Element exposing (Element, toHtml) | |
| import Collage exposing (Form, collage, move, rect, filled, circle) | |
| import AnimationFrame exposing (times) |
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
| /* | |
| WallabyJS React Native Config | |
| Works well with Jest + Enzyme | |
| */ | |
| /* eslint-disable */ | |
| module.exports = function (wallaby) { | |
| return { | |
| files: [ | |
| 'src/**/*.js', |
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
| module Cycle where | |
| import Almost (Stream, Promise, observe, Subject, holdSubject, next, complete, thenp) | |
| import Data.StrMap (fromFoldable, StrMap, keys) | |
| import Data.StrMap.Unsafe (unsafeIndex) | |
| import Data.Tuple (Tuple(..)) | |
| import Prelude (map) | |
| type Drivers a b = StrMap (Subject a -> b) | |
| type Sinks a = StrMap (Stream a) |
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
| Rx.Observable.prototype.log = function(prefix) { | |
| return process.env.NODE_ENV !== "development" ? this : this | |
| .doOnCompleted(() => console.log(prefix, "<completed>")) // eslint-disable-line | |
| .do(x => console.log(prefix, x)) // eslint-disable-line | |
| } | |
| // const obs = Rx.Observable.fromEvent(text, "input") | |
| // .log("InputEvent:") | |
| // .map(e => e.target.value) | |
| // .filter(t => !!t) |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
Should be work with 0.18
Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !
myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
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
| function counterA(state = 0, action) { | |
| switch (action.type) { | |
| case 'increment': | |
| return state + 1 | |
| case 'decrement': | |
| return state - 1 | |
| default: | |
| return state | |
| } | |
| } |
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
| import React from 'react' | |
| import ReactDOM from 'react-dom' | |
| const Hello = ({name}) => <h1>Hello {name}!</h1> | |
| ReactDOM.render( | |
| <Hello name={"vjeux"}/>, | |
| document.body.appendChild(document.createElement("div")) | |
| ) |
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
| ;; Credits: | |
| ;; | |
| ;; * ClojureScript | |
| ;; * Reagent https://reagent-project.github.io/ | |
| ;; * Figwheel https://github.com/bhauman/lein-figwheel | |
| ;; * core.async https://clojure.github.io/core.async/ | |
| ;; * Christophe Grand's Life implementation http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/ | |
| (ns life.core | |
| (:require [reagent.core :as r] |