Edit: just to be clear: My question is: is it possible to dynamically inject a function before all other function calls on a page.
I would like a single function to inject itself before all function calls. I'm trying to implement access control lists for a JS app. So for eg.
User fred can access function app.addPage()
, but he can't access function app.removePage();
So now how do I call the original function that was intended after calling the gatekeeper function?
I suppose I could modify my app so that every method call looks like this:
app.acl().functionCall();
But I wanted to inject acl()
automatically before ever function call in some dynamic way. Possible?