Skip to content

jenslind/choo-emit-once

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Choo emit.once

Emit once per route change

npm install choo-emit-once

Usage

const choo = require('choo')
const emitOnce = require('choo-emit-once')

const app = choo()

app.use(emitOnce)

app.route('/', function (state, emit) {
  emit.once('event-name')
  emit.clear('event-name')
  emit.clear()
})

app.mount('body')