Skip to content

Instantly share code, notes, and snippets.

@Ventero
Created August 3, 2014 11:45
Show Gist options
  • Save Ventero/b022e931ef9a90d05c51 to your computer and use it in GitHub Desktop.
Save Ventero/b022e931ef9a90d05c51 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name script1
// @include *
// @grant unsafeWindow
// ==/UserScript==
unsafeWindow.MouseFunction = exportFunction(function (event) {
console.log(1);
}, unsafeWindow);
unsafeWindow.addEventListener("mousedown", unsafeWindow.MouseFunction, false);
// ==UserScript==
// @name script2
// @include *
// @grant unsafeWindow
// ==/UserScript==
setTimeout(function() {
console.log("removing event listener");
unsafeWindow.removeEventListener("mousedown", unsafeWindow.MouseFunction, false);
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment