Flotype / now

NowJS makes it easy to build real-time web apps using JavaScript
http://www.nowjs.com
MIT License
1.91k stars 175 forks source link

Nested namespace supported? #111

Closed sjoerdmulder closed 13 years ago

sjoerdmulder commented 13 years ago

SERVER:

    get: function(){
        return "Hello!";  
        }
}

CLIENT:

    now.itemStorage.get();
});

But when trying this is get in my nodejs terminal:

{ stack: undefined,
  arguments: [],
  type: 'stack_overflow',
  message: [Getter/Setter] }
undefined

And it doesnt seem todo anything...

sjoerdmulder commented 13 years ago

B.T.W. im using version 0.6.1

steveWang commented 13 years ago

It is supported in NowJS 0.7.

ericz commented 13 years ago

@sjoerdmulder This should indeed work fine in 0.7 . If you are still having issues with this let me know.

Thanks Eric

sjoerdmulder commented 13 years ago

Hi,

I just tried again with version 0.7.2 (did a npm update now on the project), node version 0.4.10 and with the following code:

everyone.now.storage = {}; everyone.now.storage.get = function(){ console.log('Do something'); }

I get:

Cannot set property 'get' of undefined TypeError: Cannot set property 'get' of undefined at Object. (/home/sjoerdm/workspaces/experiments/node/server.js:43:26) at Module._compile (module.js:402:26) at Object..js (module.js:408:10) at Module.load (module.js:334:31) at Function._load (module.js:293:12) at Array. (module.js:421:10) at EventEmitter._tickCallback (node.js:126:26)

Also on the client i get a "Uncaught TypeError: Cannot call method 'get' of undefined " when trying to access the function in the now.ready() handler which is logic because of the previous log message

Thanks Sjoerd

2011/7/26 ericz < reply@reply.github.com>

@sjoerdmulder This should indeed work fine in 0.7 . If you are still having issues with this let me know.

Thanks Eric

Reply to this email directly or view it on GitHub: https://github.com/Flotype/now/issues/111#issuecomment-1649854

sjoerdmulder commented 13 years ago

The initial example i provided (using the nested object declaration) does seem to work

ericz commented 13 years ago

@sjoerdmulder, I have reproduced this issue and am looking into a fix

ericz commented 13 years ago

@sjoerdmulder, this should now be fixed in the latest github master.