UNPKG

hurt

Version:

HTTP and SPA routing using RFC 6570 URI templates

29 lines (24 loc) 516 B
'use strict'; import EventEmitter from 'eventemitter3'; import sync from './sync'; export function mixin() { const eventemitter = new EventEmitter(); return { ...eventemitter, ...EventEmitter.prototype, pre: [ sync(function (...args) { this.emit('request', ...args); }) ], post: [ sync(function (...args) { this.emit('finish', ...args); }) ], use(...args) { this.emit('handler', ...args); return this.use(...args); } }; }