made with esnextbin
made with esnextbin
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 logger (action: any, state0: any, state1: any, effect: any) { | |
if (!getGlobalConfig().dispatcherLogs) return | |
let actionName: string[] = [] | |
while (action instanceof Action) { | |
actionName.push(action.type) | |
action = action.value | |
} | |
console.groupCollapsed(actionName.join('/')) | |
console.log('ACTION', action) |
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 test () { | |
const cache = {} | |
function create (type) {return {type: type, value: new Date() }} | |
return function (type) { | |
if (cache[type]) return cache[type] | |
const c = create(type) | |
cache[type] = c | |
return c | |
} | |
} |
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> | |
<meta charset="utf-8"/> | |
<title>call vs apply #jsbench #jsperf</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
/** | |
* Created by tushar on 29/11/16. | |
*/ | |
import * as O from 'observable-air' | |
export class Action<T> { | |
constructor (public readonly type: string, public readonly value: T) { | |
} | |
static of<T> (type: string, value: 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
/** | |
* Created by tushar on 29/11/16. | |
*/ | |
import * as O from 'observable-air' | |
type faco = <F> (t: F) => Action<F> | |
export class Action<T> { | |
constructor (public readonly type: string, public readonly value: 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
const assert = require('assert') | |
console.log('NODE:', process.version) | |
console.log('V8:', process.versions.v8, '\n--------------') | |
class Bind { | |
constructor () { | |
this.value = 1000 | |
this.update = this.__update.bind(this) | |
} | |
__update () { |
made with esnextbin