I want to overwrite the setTimeout function with my custom variant. I am searching for the recomended way to do this.
I have found two solutions with unsafeWindow: unsafeWindow.setTimeout = myFunc; // this works unsafeWindow.__proto__.setTimeout = myFunc; // this works too I read up on __proto__, but I still am not sure whether there is a practical difference between these two. Is one recommended over the other? I know that references to unsafeWindow are best avoided. However I have trouble working without it. I experimented with the content scope runner: http://wiki.greasespot.net/Content_Scope_Runner I got it to work in very basic test cases only, I have trouble adapting it for my purposes. It seems to crash silently in a number of cases, without reporting any error to the console. (not talking about GM_log, but standard javacript error messages) Is error reporting disabled by design, or is this a bug? Is there a better way to overwrite global functions? -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
