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
Post a Comment