'ello. I'd like to use the Seaside javascript facilities to instantiate a javascript class of mine.
What I'd like is an example or something, because looking at the Seaside code and the jQuery classes and stuff is rather confusing. My class is simple, however. Basically, all I need is to instantiate a variable: x = MyClass(); and evaluate some setters: x.setVar('blah'); and then evaluate x.update(); on an interval... which JSObject provides. Thanks, RS _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi Robert,
The obligatory first question: Do you really need to write it using Seaside's JSObjects? In other words: is there a reason not to use a plain javascript string or even an external javascript file? But here are the samples you requested. I would never write them like that unless you want to integrate such statements in seaside-generated javascript. (JSStream on: 'x') assign: ((JSStream on: 'MyClass') apply: #()) (JSStream on: 'x') call: 'setVar' withArguments: (Array with:'blah') ((JSStream on: 'x') call: 'update') timeout: 100 Hope it helps! Johan On 23 Jun 2011, at 05:18, Robert Sirois wrote: > 'ello. I'd like to use the Seaside javascript facilities to instantiate a javascript class of mine. > > What I'd like is an example or something, because looking at the Seaside code and the jQuery classes and stuff is rather confusing. > > My class is simple, however. Basically, all I need is to instantiate a variable: > > x = MyClass(); > > and evaluate some setters: > > x.setVar('blah'); > > and then evaluate x.update(); on an interval... which JSObject provides. > > Thanks, > RS > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks Johan, I appreciate it.
It is partially a learning exercise ;) In truth I could just do some string concatenation... I just need to set a bunch of things up front. RS > Subject: Re: [Seaside] Subclassing JSObject > From: [hidden email] > Date: Thu, 23 Jun 2011 14:46:55 +0200 > To: [hidden email] > > Hi Robert, > > The obligatory first question: Do you really need to write it using Seaside's JSObjects? > In other words: is there a reason not to use a plain javascript string or even an external javascript file? > > But here are the samples you requested. > I would never write them like that unless you want to integrate such statements in seaside-generated javascript. > > (JSStream on: 'x') assign: ((JSStream on: 'MyClass') apply: #()) > > (JSStream on: 'x') call: 'setVar' withArguments: (Array with:'blah') > > ((JSStream on: 'x') call: 'update') timeout: 100 > > Hope it helps! > Johan > > On 23 Jun 2011, at 05:18, Robert Sirois wrote: > > > 'ello. I'd like to use the Seaside javascript facilities to instantiate a javascript class of mine. > > > > What I'd like is an example or something, because looking at the Seaside code and the jQuery classes and stuff is rather confusing. > > > > My class is simple, however. Basically, all I need is to instantiate a variable: > > > > x = MyClass(); > > > > and evaluate some setters: > > > > x.setVar('blah'); > > > > and then evaluate x.update(); on an interval... which JSObject provides. > > > > Thanks, > > RS > > _______________________________________________ > > seaside mailing list > > [hidden email] > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Johan Brichau-2
Am I correct in calling the JSObject this way through a render method?
html document addLoadScript: (AJSObjectSubclass context: html). Then the code gets called in #javascriptContentOn:? RS > Subject: Re: [Seaside] Subclassing JSObject > From: [hidden email] > Date: Thu, 23 Jun 2011 14:46:55 +0200 > To: [hidden email] > > Hi Robert, > > The obligatory first question: Do you really need to write it using Seaside's JSObjects? > In other words: is there a reason not to use a plain javascript string or even an external javascript file? > > But here are the samples you requested. > I would never write them like that unless you want to integrate such statements in seaside-generated javascript. > > (JSStream on: 'x') assign: ((JSStream on: 'MyClass') apply: #()) > > (JSStream on: 'x') call: 'setVar' withArguments: (Array with:'blah') > > ((JSStream on: 'x') call: 'update') timeout: 100 > > Hope it helps! > Johan > > On 23 Jun 2011, at 05:18, Robert Sirois wrote: > > > 'ello. I'd like to use the Seaside javascript facilities to instantiate a javascript class of mine. > > > > What I'd like is an example or something, because looking at the Seaside code and the jQuery classes and stuff is rather confusing. > > > > My class is simple, however. Basically, all I need is to instantiate a variable: > > > > x = MyClass(); > > > > and evaluate some setters: > > > > x.setVar('blah'); > > > > and then evaluate x.update(); on an interval... which JSObject provides. > > > > Thanks, > > RS > > _______________________________________________ > > seaside mailing list > > [hidden email] > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |