Thanks for the reply, tried both with no success. I know it's not scope completely because if I declare 'client' globally (placing 'var client;' at the top of doc) it knows about it. ie changing 'client.addEvent()' to 'client.add1Event' produces Uncaught TypeError: Object [object Object] has no method 'add1Event'. But doesn't seem to fire when its right. Its like the object is there but they aren't on the same channel?
On May 11, 12:28 am, Omar Chanouha <[email protected]> wrote: > Try removing the var from the client declaration. Or declare client > outside of the document.ready > > -O > > > > > > > > On Thu, May 10, 2012 at 8:49 AM, Maxus <[email protected]> wrote: > > Can someone please help, I'm sure there is something simple I'm > > missing but I just can't get it. > > > I'm including Clients/JavaScript.js, Demos/config.js and my custom js > > script file in the parent document. Within the js script file I'm > > trying to use APE but am having issues. > > > Within a jquery document ready function I'm loading the server etc. > > ie: > > > var client = new APE.Client(); > > > client.load({'channel': 'test'}); > > client.addEvent('load', function() { > > client.core.start({'name': new Date().getTime().toString())}); > > }); > > client.addEvent('multiPipeCreate', function(pipe) { > > client.onRaw('info', function(params) { > > console.log('info: '+params.data.item1+' - '+params.data.item2+' > > - '+params.data.item3); > > }); > > }); > > > This works fine. I then have a bunch of functions which I'd like to > > add send events to. So I try adding this code to them: > > > client.addEvent('multiPipeCreate', function(pipe) { > > pipe.request.send('getInfo', {'input1': 'abc', 'input2': 'xyz', > > 'input3': '123'}); > > }); > > > Its strange as it only ever works if it's placed straight below the > > top code that creates the client and connects to the server... Even if > > its placed directly within an onclick listener, within the document > > ready block it fails to fire. I'm sure it's scope related but can't > > work it out. Please help as I'm losing the little hair I have left! :) > > > Thanks > > Maxus > > > -- > > You received this message because you are subscribed to the Google > > Groups "APE Project" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/ape-project?hl=en > > --- > > APE Project (Ajax Push Engine) > > Official website :http://www.ape-project.org/ > > Git Hub :http://github.com/APE-Project/ -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/
