diff --git a/package.json b/package.json index cb2505d0..7d900e09 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zeed", "type": "module", - "version": "0.13.17", + "version": "0.13.18", "description": "🌱 Simple foundation library", "author": { "name": "Dirk Holtwick", diff --git a/src/common/dispose-utils.ts b/src/common/dispose-utils.ts index f86d30e5..c5effc31 100644 --- a/src/common/dispose-utils.ts +++ b/src/common/dispose-utils.ts @@ -93,14 +93,13 @@ export function useEventListenerOnce( /** Like useDispose but with shorthands for emitter and timers */ export function useDisposeWithUtils(config?: string | UseDisposeConfig | LoggerInterface) { const dispose = useDispose(config) - Object.assign(dispose, { + return Object.assign(dispose, { timeout: (fn: DisposerFunction, timeout = 0) => dispose.add(useTimeout(fn, timeout)), interval: (fn: DisposerFunction, interval = 0) => dispose.add(useInterval(fn, interval)), intervalPause: (fn: DisposerFunction, interval = 0) => dispose.add(useIntervalPause(fn, interval)), on: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => dispose.add(useEventListener(emitter, eventName, fn, ...args)), once: (emitter: any, eventName: string, fn: (ev?: any) => void, ...args: any[]) => dispose.add(useEventListenerOnce(emitter, eventName, fn, ...args)), }) - return dispose } export type UseDisposeWithUtils = ReturnType