Tobias Beer
unread,Nov 21, 2009, 6:28:06 AM11/21/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TiddlyWiki
Hi again RA,
So, here's maybe the missing link between your question and my
previous reply...
1) For a "proper" hijack you always start with storing the original
function...
if (Story.prototype.someCoreFunction_myBackupOf==undefined)
Story.prototype.someCoreFunction_myBackupOf
=Story.prototype.someCoreFunction;
2) Overwriting the original, your function is then declared based on
the previous functions premises, possibly customized to what you
actually need...
Story.prototype.someCoreFunction = function(my,args) {
//...
3) However, somewhere in the code of your replacemet - preferably at
the very end - you are to call the original function, otherwise you're
not quite hijacking, but rather merely overwriting the original...
this.someCoreFunction_myBackupOf.apply(this,arguments);
Note the __apply(this,arguments)__ part, shoving over all of what you
possibly ignored. There you go, another how-to-properly hijack in 5
Minutes plus some more...
As for me, this - and what I mentioned before, and also object
literals, array shorthands, functions as firstclass objects, etc... -
is the kind of stuff where javascript slowly but profoundly starts
making you feel that it's not just some cheap-ass browser scripting
engine, but rather in the realm of the more powerful tools for
expressing yourself in code around today ...lean and mean ;-)
Tobias.