On Sun, Sep 28, 2008 at 6:37 PM, William Becker <[EMAIL PROTECTED]> wrote:
> Hi all! > > I have split up jabsorb.js (formerly jsonrpc.js) into 2 files The first > file has all the ordinary json-rpc goodness we have come to expect from > jabsorb, except it lacks circular reference capabilities. The second file > overrides the first's toJSON and fromJSON methods so that circular > references can be used. It all seems to work fine, the second passes all > unit tests, the first gracefully fails circular reference tests (it doesn't > lock up the browser, it just throws exceptions when the circular reference > is caught). > > If you want circ refs, include both files and create the client using > jabsorb-fixups(callbackFunction). > Otherwise only include only jabsorb.js and create the client with > jabsorb(callbackFunction). Even if both files are included you may still use > only the non-circ-ref client. > > This is a much neater way of doing things, using late binding to perform > the right function. It also means that if you are not using circular > references, you may notice a modest speed up in the execution of your code. > > The next step in this is to do away with sync calls and put the capability > of using these in a third file. > > I am not sure if breaking this up into many files is a good way to go. > There are a couple options and I would be interested to hear of anyone's > preference. > > * We could split it up into many files, and let developers just include the > ones they want. > * We could split it up, but also include an autoloader, which does > automagical dojo style loading of the files it depends upon. > * We could distribute files which contain all the available javascript code > in one file. If we call this jsonrpc.js then this would ensure backwards > compatibility. > > These ideas are not mutually exclusive, so it could be possible to do all > 3. > > At any rate, I welcome any feedback users might have before I go and check > this in! > > Cheers, > Will > > Hi Will, thanks for spending so much time on this. I wish I had more time to review what you are doing and help out. I looked at your code (very briefly) seems nice... I guess, like you said, the primary downside of this is that if most people want circ refs, fixups, etc. then they would have to always include two files, meaning a slight load penalty for having to load an extra script. Maybe we could name the third file, jabsorb-all.js that has both files already combined (The ant script could generate it) I thought we were going to provide the old (1.3x) implementation as jsonrpc.js with sync support for awhile going forward... I know in my own use I would probably always use the "combined" version and not want to have to include 2 files... Should we call the jabsorb-fixups.js file, jabsorb-circrefs.js or jabsorb-circref-support.js instead? Just to make it a little more clear what the file is for? I'm not sure on this one. "fixups" is more accurate, but also probably more confusing for people not familiar with jabsorb although we could probably solve that with good documentation too. At least change the comment at the top of jabsorb-fixups to clearly state what the file is for, when to include it, how to use it, etc.
_______________________________________________ Jabsorb-dev mailing list [email protected] http://lists.jabsorb.org/mailman/listinfo/jabsorb-dev
