UNPKG

preact-batteries

Version:

Batteries for you projects with Preact, TypeScript (or Babel)

13 lines (10 loc) 230 B
class Dispatcher { callbacks = []; register(callback: (payload: any) => void) { this.callbacks.push(callback); } dispatch(payload: any) { this.callbacks.forEach(c => c(payload)); } } export default Dispatcher;