export function once(cb: (...args: T[]) => void) { let state = { called: false } return (...args: T[]) => { if (state.called) return state.called = true return cb(...args) } }