electron - How to unregister events in atom-shell? -


i making application using atom-shell needs load several html pages. each time load different page, need execute custom script. using mainwindow.webcontents.on('did-finish-load', ...). since need have custom function each file, unregister did-finish-load event.

example:

mainwindow.webcontents.on('did-finish-load',function() {     console.log('loaded page1');     mainwindow.webcontents.unregister('did-finish-load') // <= exist? }); mainwindow.loadurl('file://.../page1.html'); 

browserwindow extends eventemitter, remove listener same way typically in node.js:

var handler = function () {     // ... }; mainwindow.webcontents.on('did-finish-load', handler);  // later: mainwindow.webcontents.removelistener('did-finish-load', handler); 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -