Tabnine Logo For Javascript
Window.addEventListener
Code IndexAdd Tabnine to your IDE (free)

How to use
addEventListener
function
in
Window

Best JavaScript code snippets using builtins.Window.addEventListener(Showing top 15 results out of 44,415)

origin: Binaryify/NeteaseCloudMusicApi

/**
 *  @Lifecycle Activate
 *  New one activated when old isnt being used.
 *
 *  waitUntil(): activating ====> activated
 */
self.addEventListener('activate', (event) => {
 event.waitUntil(self.clients.claim())
})
origin: GitSquared/edex-ui

// Touch
    function modalTouchstartHandler(e) {
      draggedModal.lastMouseX = e.changedTouches[0].clientX;
      draggedModal.lastMouseY = e.changedTouches[0].clientY;

      draggedModal.setAttribute("style", `${draggedModal.zindex}background: rgba(var(--color_r), var(--color_g), var(--color_b), 0.5);left: ${draggedModal.posX}px;top: ${draggedModal.posY}px;`);

      window.addEventListener("touchmove", modalTouchmoveHandler);
      window.addEventListener("touchend", modalTouchendHandler);
    }
origin: i5ting/nodejs-fullstack

/**
   * Hides the address bar if we're on a mobile device.
   */
  function hideAddressBar() {

    if( config.hideAddressBar && isMobileDevice ) {
      // Events that should trigger the address bar to hide
      window.addEventListener( 'load', removeAddressBar, false );
      window.addEventListener( 'orientationchange', removeAddressBar, false );
    }

  }
origin: keystonejs/keystone

memo(function PreventNavigation() {
 // to handle when the user closes the tab, does an actual browser navigation away or etc.
 useEffect(() => {
  const handler = event => {
   event.preventDefault();
  };
  window.addEventListener('beforeunload', handler);
  return () => window.removeEventListener('beforeunload', handler);
 }, []);
 // to handle the user clicking a react-router Link
 return <Prompt when message="This page has unsaved data. Are you sure you want to leave?" />;
})
origin: GitSquared/edex-ui

window.addEventListener("blur", () => {
      document.querySelectorAll("div.keyboard_key.active").forEach(key => {
        key.setAttribute("class", key.getAttribute("class").replace("active", ""));
        key.onmouseup({preventDefault: () => {return true}});
      });
    });
origin: princejwesley/Mancy

componentWillUnmount() {
  this.unsubscribe();
  window.removeEventListener('keydown', this.onWindowEvents, false);
  window.addEventListener('blur', this.onWindowEvents, false);
 }
origin: princejwesley/Mancy

componentDidMount() {
  this.unsubscribe = ReplSuggestionStore.listen(this.onStateChange);
  window.addEventListener('keydown', this.onWindowEvents, false);
  window.addEventListener('blur', this.onWindowEvents, false);
 }
origin: schn4ck/schnack

self.addEventListener('notificationclick', (event) => {
  event.notification.close();

  if(clients.openWindow){
    event.waitUntil(clients.openWindow(self.clickTarget));
  }
});
origin: GitSquared/edex-ui

// Fix #265
window.addEventListener("keyup", e => {
  if (e.key === "F4" && e.altKey === true) {
    electron.remote.app.quit();
  }
});
origin: Automattic/wp-calypso

componentDidMount() {
    window.addEventListener( 'resize', this.redraw );
    if ( this.noteList ) {
      this.height = ReactDOM.findDOMNode( this.noteList ).clientHeight;
    }
  }
origin: Automattic/wp-calypso

componentDidMount() {
    window.addEventListener( 'keydown', this.handleSuggestionsKeyDown, false );
    window.addEventListener( 'keyup', this.handleSuggestionsKeyUp, false );
    window.addEventListener( 'blur', this.handleSuggestionBlur, true );

    this.props.fetchSuggestions( this.props.note.meta.ids.site );
  }
origin: strapi/strapi

componentDidMount() {
  // Listen window resize.
  window.addEventListener('resize', this.setBoostrapCol);
  this.setBoostrapCol();
 }
origin: GitSquared/edex-ui

// Fix #265
window.addEventListener("keyup", e => {
  if (e.key === "F4" && e.altKey === true) {
    electron.remote.app.quit();
  }
});
origin: GitSquared/edex-ui

window.addEventListener("blur", () => {
      document.querySelectorAll("div.keyboard_key.active").forEach(key => {
        key.setAttribute("class", key.getAttribute("class").replace("active", ""));
        key.onmouseup({preventDefault: () => {return true}});
      });
    });
origin: GitSquared/edex-ui

// Touch
    function modalTouchstartHandler(e) {
      draggedModal.lastMouseX = e.changedTouches[0].clientX;
      draggedModal.lastMouseY = e.changedTouches[0].clientY;

      draggedModal.setAttribute("style", `${draggedModal.zindex}background: rgba(var(--color_r), var(--color_g), var(--color_b), 0.5);left: ${draggedModal.posX}px;top: ${draggedModal.posY}px;`);

      window.addEventListener("touchmove", modalTouchmoveHandler);
      window.addEventListener("touchend", modalTouchendHandler);
    }
builtins(MDN)WindowaddEventListener

Most used builtins functions

  • Console.log
  • Console.error
  • Promise.then
    Attaches callbacks for the resolution and/or rejection of the Promise.
  • Promise.catch
    Attaches a callback for only the rejection of the Promise.
  • Array.push
    Appends new elements to an array, and returns the new length of the array.
  • Array.length,
  • Array.map,
  • String.indexOf,
  • fetch,
  • Window.location,
  • Window.addEventListener,
  • ObjectConstructor.keys,
  • Array.forEach,
  • Location.reload,
  • Response.status,
  • Navigator.serviceWorker,
  • ServiceWorkerContainer.register,
  • ServiceWorkerRegistration.installing,
  • ServiceWorkerContainer.controller

Popular in JavaScript

  • crypto
  • handlebars
    Handlebars provides the power necessary to let you build semantic templates effectively with no frustration
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • axios
    Promise based HTTP client for the browser and node.js
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • redis
    Redis client library
  • debug
    small debugging utility
  • http
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now