i am trying to figure out how to work with Ape, but there are some things in the chat demo code that i dont understand and cant find nothing about it in the documentation. here is the code:
var userlist = new $H;
Ape.registerHookCmd("connect", function(params, cmd) {
if (!$defined(params.name)) return 0;
if (userlist.has(params.name.toLowerCase())) return ["005", "NICK_USED"];
if (params.name.length > 16 || params.name.test('[^a-zA-Z0-9]', 'i')) return ["006", "BAD_NICK"];
cmd.user.setProperty('name', params.name);
return 1;
});
Ape.addEvent('adduser', function(user) {
userlist.set(user.getProperty('name').toLowerCase(), true);
});
Ape.addEvent('deluser', function(user) {
userlist.erase(user.getProperty('name').toLowerCase());
});
on the first line when userlist is define what is that $H? i cant find anything about it in the documentation and on the forth line userlist.has, where can i read about this .has, i understand what it means but im thinking maybe there are more commands like that. if anyone has worked with ape and can hel开发者_Go百科p me with this, it would help me very much.
thanks
I think that's a MooTools Hash: http://mootools.net/docs/core125/core/Native/Hash
精彩评论