Skip to content
Myr

example.js

This file

Path

example.js

20 lines · 467 bytes · JavaScript

Last changed by

add editorconfig, fix original identationtunnckoCorebefore adoptione7c222c

History of this file

Take it

add example.jstunnckoCorebefore adoption8b4f2de

lines 1–6why, one step back
1'use strict'
23var mitt = require('./dist/mitt')4var ee = mitt()56ee

add editorconfig, fix original identationtunnckoCorebefore adoptione7c222c

lines 7–12why, one step back
7 .on('*', (type, arg) => console.log('wildcard:', type, arg))
8 .on('foo', (one, two, three) => console.log('foo1:', one, two, three))9 .on('foo', (one, two, three) => console.log('foo2:', one, two, three))10 .on('bar', (arg) => console.log('bar:', arg))11 .emit('foo', 1, 2, 3)12 .emit('bar', 444)

add example.jstunnckoCorebefore adoption8b4f2de

lines 13–20why, one step back
13
14console.log(ee.all)1516var emitter = mitt()1718console.log(emitter.all) // => {}1920emitter.emit('foo', 777)