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
@@ -23,8 +23,8 @@ export function useSubscription({ getCurrentValue, subscribe }) { | |
useEffect(() => { | |
let didUnsubscribe = false; | |
- | |
- const checkForUpdates = () => { | |
+ // NOTICE: value coming from subscription not from getCurrentValue !!! | |
+ const onValue = value => { | |
if (didUnsubscribe) { | |
return; |
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 * as L from "partial.lenses"; | |
interface State { | |
foo: { | |
lol: number; | |
bal: string; | |
}; | |
items: Item[]; | |
} |
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
const vm = require("vm"); | |
const { resolve, run } = require("./sync"); | |
// in "master" | |
const calls = []; | |
const log = console.log.bind(console); | |
const random = Math.random; | |
// in "worker" |
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 * as O from "most" | |
import * as L from "partial.lenses" | |
import DOM from "@culli/dom" | |
import Store, {Memory, byType} from "@culli/store" | |
import {run} from "@cycle/most-run" | |
// partial.lenses lens => culli lens | |
const P = (pl) => ({ | |
get: L.get(pl), | |
set: L.set(pl) |
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 {O, extend} from "@culli/base" // you can replace this with your own streaming library if you want | |
import Memory from "./memory" | |
function ReduxDevtools(initial) { | |
const devtools = window.__REDUX_DEVTOOLS_EXTENSION__ | |
if (!devtools) { | |
return Memory(initial) | |
} |
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 * as O from "most" | |
import {run} from "@cycle/most-run" | |
import DOM from "@culli/dom" | |
import Store, {Memory} from "@culli/store" | |
import HTTP from "@culli/http" | |
run(GithubSearch, { | |
DOM: DOM("#app"), | |
// create store using in-memory persintence |
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 {Observable as O} from "rx" | |
const store = reducer => R.lens(R.identity, reducer) | |
const myStore = store((action, state) => { | |
switch (action.type) { | |
case "INC": return state + 1 | |
case "DEC": return state - 1 | |
default: return state | |
} |
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
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) |
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 Rx, {Observable as O} from "rx" | |
import Cycle from "@cycle/core" | |
import {h, makeDOMDriver} from "@cycle/dom" | |
import isolate from "@cycle/isolate" | |
function Counter({DOM, initial$}) { | |
const mod$ = O.merge( | |
DOM.select(".dec").events("click").map(ev => state => state - 1), | |
DOM.select(".inc").events("click").map(ev => state => state + 1) | |
) |
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 {Observable as O} from 'rx' | |
import L from "partial.lenses" | |
import R from "ramda" | |
import {h3, div} from '@cycle/dom' | |
import isolate from '@cycle/isolate' | |
import Ticker from './ticker' | |
import {liftListById, flatCombine, flatMerge} from "stanga" | |
function intent(tickers$) { |
NewerOlder