Skip to content

Instantly share code, notes, and snippets.

@opensourcekam
Created March 9, 2020 20:27
Show Gist options
  • Save opensourcekam/95e8d86d485145359f33358a60da616a to your computer and use it in GitHub Desktop.
Save opensourcekam/95e8d86d485145359f33358a60da616a to your computer and use it in GitHub Desktop.

Revisions

  1. opensourcekam created this gist Mar 9, 2020.
    3 changes: 3 additions & 0 deletions eventListernersUtil.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    export const on = (obj: any, ...args: any[]) => obj.addEventListener(...args);

    export const off = (obj: any, ...args: any[]) => obj.removeEventListener(...args);
    5 changes: 5 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    import {on, off} from './eventListernersUtil';

    // on(document, 'visibilitychange', onVisibility);

    // off(document, 'visibilitychange', onVisibility);