✔ Platform [pass: 1, fail: 0, duration: 1ms]
✔ init [pass: 22, fail: 0, duration: 1ms]
✔ emit [pass: 27, fail: 0, duration: 12ms]
✔ emit with context [pass: 42, fail: 0, duration: 5ms]
✔ emit one value - two listeners [pass: 57, fail: 0, duration: 2ms]
✔ emit one value - one listener [pass: 40, fail: 0, duration: 1ms]
✔ emit many listeners [pass: 30, fail: 0, duration: 1ms]
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
var barracks = require('barracks'); | |
var dispatcher = barracks(); | |
dispatcher.on('hello', function (name) { | |
document.write('Hello ' + name); | |
}); | |
dispatcher.on('hello', function (name) { |
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
node_modules |
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> | |
<link rel="stylesheet" href="style.css"> | |
<script src="https://d3js.org/d3-dispatch.v0.4.min.js"></script> | |
<script> | |
var dispatch = d3_dispatch.dispatch('foo'); | |
dispatch.on('foo', handle); |
EventEmitter ................................... 184,353 op/s
EventEmitter2 .................................. 1,366,034 op/s
EventEmitter3 .................................. 4,718,065 op/s
RXJS ........................................... 1,388,534 op/s
ReactiveProperty ............................... 5,766,001 op/s
JS-Signals ..................................... 175,555 op/s
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
'use strict' | |
var Benchmark = require('benchmark') | |
var suite = new Benchmark.Suite; | |
var list = [1, 2, 3, [[4]], [[[5]]], [6], [[7]]] | |
function flattenRecursive (list) { | |
var flatList = [] | |
list.forEach(function (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 dict = require('dictionary-js'); | |
const words = Object.keys(dict); | |
const xwords = xx => words.filter(x => x[0] === xx); | |
const kwords = xwords('K') | |
const iwords = xwords('I') | |
function randomWord (list) { | |
return list[Math.floor(Math.random() * list.length)]; | |
}; |
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
Show hidden characters
{ | |
"presets": [ "es2015-rollup" ] | |
} |
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
var Tokenizer = require('tokenizer'); | |
var t = new Tokenizer(); | |
t.on('token', function(token, type) { | |
console.log(token); | |
}); | |
t.on('end', function() { | |
console.log(arguments); | |
}); |