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
export function injectRootState({getState}) { | |
return next => action => { | |
action = next(action); | |
(action.meta || (action.meta = {})).rootState = getState(); | |
return action; | |
} | |
} | |
export function withSelectors(...selectors) { | |
const reducer = selectors.pop(); |
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 {bindActionCreators} from 'redux'; | |
export function withSelectors(...selectors) { | |
const bound = selectors.pop(); | |
return (...args) => { | |
const state = args[args.length-1].getState(); | |
return bound(...selectors.map( sel => sel(state) ), ...args); | |
} | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>COVID-19 testing progress based on covidtracking.com</title> | |
<style type="text/css"> | |
body { | |
font-family: sans-serif; | |
} | |
.pane { |
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
export default function() { console.log( "A" ) } |
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
function bindClosureSlot( name ) { | |
return "function(v){ if( arguments.length<1 ) return " + name + "; else return " + name + "=v; }"; | |
} | |
function evalInClosureExt( code, closure ) { | |
return Function.apply( | |
null, | |
Object.keys( closure ).concat( | |
"return [" + | |
code + "," + |
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
// One-way property binders | |
function bindNowGetProp( propname, obj ) { | |
return function() { return obj[propname]; } | |
} | |
function bindNowSetProp( propname, obj ) { | |
return function(v){ return obj[propname] = v; } | |
} |
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
function Def( arg ) { | |
if( arg instanceof Def ) | |
this.parent = arg; | |
else if( typeof arg !== "undefined" ) | |
this.v = arg; | |
} | |
Def.prototype = { | |
chain: function(v){ |