[Kss-devel] Kupu kss plugin | overhead
Vladislav Vorobiev
mymir.org at googlemail.com
Sun Oct 5 15:26:49 CEST 2008
Hello Balazs,
> Is this code publicly available somewhere?
Now the source code http://dev.kss.static.mymir.org/
and working example
http://mymir.ru/kssplugintutorial
And there are two python scripts.
for return of kupuMacros and Save Form.
returnKupuMacros
===========
request = context.REQUEST
from kss.core.ttwapi import ( startKSSCommands, getKSSCommandSet,
renderKSSCommands )
startKSSCommands(context, request) # boilerplate
con=context.kupuMacros()
core=getKSSCommandSet('core').replaceInnerHTML('#mybody', con)
return renderKSSCommands()
> I don't understand this. I'm not aware of zope analizing any js code. Can
> you please provide some more details?
But it seems to be. If I put in tutorialplugin.js only something like this
alert('blja');
it make no overhead by first start. You can download and try it youself.
> There is no standard method. Most js library provide this, in various
> different ways.
>
> I myself, wrote an on-demand js loader, that works with kss (it uses the
> RequestManager for the actual request). It works on all the browsers I
> tried on. Basically, it accepts a set of javascript resources to load.
> Loading is done in parallel, with the limitation of maximal requests
> and timeout handling provided by kss natively.
> When these are all loaded and evaluated, it calls the specified callback
> where you can continue execution. If the resources are already present,
> or have been included in the static headers, they are not loaded again.
>
> For loading kss components (like, plugins) this may not work very well:
> first it could actually make page load slower because the resources
> loaded on demand are acquired much later during the page load, than in
> the static way. Second, kss should be able to freeze its engine until
> these resources are loaded and resume processing later from the callback;
> this is currently not supported in the way that would be necessary
> for this use.
>
> However it can be a viable solution for loading thirdparty javascript
> code like in your case. This is what I used it for: loading the jsMath
> library, that is pretty big, from a kss action that needs it.
> If the code is there the action executes immediately, if not, the
> resource is loaded and the action continues after it became available.
> In my use case delay caused by the load was no problem either, for the usage.
>
> The code that does this is part of the kss.plugin.jsmath: please feel
> free to copypaste it to your own code and experiment with it. In case
> more people find it useful, it can go to a component on its own.
>
> http://bazaar.launchpad.net/~kissbooth/kss.plugin.jsmath/trunk/annotate/21?file_id=kss_jsmath.js-20071127201149-79dx2pzwy2ftq08k-32
>
Thanks, I try it next time of course :-).
--
Best Regards
Vlad Vorobiev
http://mymir.ru/
More information about the Kss-devel
mailing list