• Andrew Price's avatar
    New mwjs API · 76808c88
    Andrew Price authored
    - Better namespacing.
    - Useful message objects.
    - New generic event mechanism instead of just message received events.
    - mw.onevent array of function refs instead of weird bind() calls:
      > mw.onevent.push(myhandler);
    - Discoverable:
      > mw.print(Object.getOwnPropertyNames(mw));
      onevent,print,exec,say,wholist,urlget,beep,input,termsize
    
    Example:
    
      function handler(ev)
      {
            if (ev.type == "message_received") {
                    msg = ev.data;
                    // Some fields only defined for certain message types
                    mw.print("msg.text: " + msg.text);
                    mw.print("msg.unixtime: " + msg.unixtime);
                    mw.print("msg.serial: " + msg.serial);
                    mw.print("msg.ipc_type: " + msg.ipc_type);
                    mw.print("msg.from_name: " + msg.from_name);
                    mw.print("msg.to_name: " + msg.to_name);
                    mw.print("msg.type: " + msg.type);
                    mw.print("msg.excluded_name: " + msg.excluded_name);
                    mw.print("msg.suffix: " + msg.suffix);
            }
      }
      mw.onevent.push(handler);
    76808c88
Name
Last commit
Last update
colour Loading commit data...
debian-template Loading commit data...
duktape Loading commit data...
help Loading commit data...
po Loading commit data...
scripthelp Loading commit data...
src Loading commit data...
talkhelp Loading commit data...
webclient Loading commit data...
wizhelp Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
COPYING Loading commit data...
HACKING Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
Makefile.common Loading commit data...
README Loading commit data...
login.banner Loading commit data...
mw.service Loading commit data...
mw.spec Loading commit data...
mwjs.rst Loading commit data...
mwserv.init Loading commit data...