Skip to content
Myr

example.js

This file

Path

example.js

20 lines · 485 bytes · JavaScript

Last changed by

update example.jstunnckoCorebefore adoption6a9154a

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

line 7why, one step back
7 .on('*', (type, arg) => console.log('wildcard:', type, arg))

update example.jstunnckoCorebefore adoption6a9154a

lines 8–11why, one step back
8 .on('foo', (one, c) => console.log('foo1:', one)) // => 1
9 .on('foo', (one) => console.log('foo2:', one)) // => 110 .on('bar', (arg) => console.log('bar:', arg)) // => 44411 .emit('foo', 1, 2, 3) // we not support multiple arguments

add editorconfig, fix original identationtunnckoCorebefore adoptione7c222c

line 12why, one step back
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)