I have a custom rss reader that downloads rss feeds and saves them as a
html tiddler. I used html because I wanted to target an iframe in
another tiddler. I know I could have done that in javascript but I also
wanted to be able to use the browsers rightclick menu to open links in a
new tab, for instance.
Anyway each feed has a toolbar which has a buttons to force an update
(outside of the normal update checks) and resize the box etc and each
entry also has buttons for hiding and showing of descriptions etc.
These use a onclick using functions inside my plugin. In pre 2.1 these
worked but in the 2.1 betas they dont.
The javascript console says the functions are not defined. Is there a
way I can access the functions from outside the main plugin code?
all the best
Mark Cheetham
Can you be more specific about which functions are being reported as
not defined? Better yet, can you share the code?
Cheers
Jeremy
--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com
> The javascript console says the functions are not defined. Is there a
> way I can access the functions from outside the main plugin code?
Can you be more specific about which functions are being reported as
not defined? Better yet, can you share the code?
var f = new Function("tiddler","pluginInfo",tiddler.text);
f(tiddler,p);
It's how plugins get access to the new "tiddler" and "pluginInfo"
parameters. I hadn't realised the impact the change has on calling
things defined in other plugins, and I'd think that it maybe it *is* a
dealbreaker, because it's surely going to break a few things out
there, and the "window." workaround is clumsy. What do you reckon?
Cheers
Jeremy
OK, this is because of a deliberate change to the way that plugins are
executed. What was once just a window.eval is now:
var f = new Function("tiddler","pluginInfo",tiddler.text);
f(tiddler,p);
It's how plugins get access to the new "tiddler" and "pluginInfo"
parameters. I hadn't realised the impact the change has on calling
things defined in other plugins, and I'd think that it maybe it *is* a
dealbreaker, because it's surely going to break a few things out
there, and the "window." workaround is clumsy. What do you reckon?
- Revert to the earlier behaviour of using window.eval to execute the
plugin code
- Pass the necessary parameters to the plugin via a global variable
(eg "pluginContext {tiddler, pluginInfo}")
The result will be to keep compatibility with 2.0.x but still provide
a means to access the parameters.
It's not pretty, but I think it's preferable to breaking backwards
compatibility.
Cheers
Jeremy
I think the best thing to do is:
- Revert to the earlier behaviour of using window.eval to execute the
plugin code
- Pass the necessary parameters to the plugin via a global variable
(eg "pluginContext {tiddler, pluginInfo}")
The result will be to keep compatibility with 2.0.x but still provide
a means to access the parameters.
It's not pretty, but I think it's preferable to breaking backwards
compatibility.
I think the best thing to do is:
- Revert to the earlier behaviour of using window.eval to execute the plugin code
http://trac.tiddlywiki.org/tiddlywiki/changeset/566
Cheers
Jeremy