PsyTask | API Docs
    Preparing search index...

    Function on

    • Add event listener and return cleanup function

      Type Parameters

      Parameters

      • target: T
      • type: K
      • listener: (
            ev: `on${K}` extends P
                ? (T[P] & {}) extends F ? Parameters<F>[0] : never
                : never,
        ) => void
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns () => void

      Listen to window resize event

      const cleanup = on(window, 'resize', (e) => {});