uupaa.eventhandler.js

0.0.3 • Public • Published

EventHandler.js Build Status

npm

Geniric Event Handler.

Browser and NW.js(node-webkit)

<script src="<module-dir>/lib/WebModule.js"></script>
<script src="<module-dir>/lib/EventHandler.js"></script>
<script>
    function a1(event) {
        console.log("call a1. detail: " + JSON.stringify(event.detail));
    }
    function a2(event) {
        console.log("call a2. detail: " + JSON.stringify(event.detail));
    }

    var event = new EventHandler(["type-a", "type-b"]);

    event.on("type-a", a1);
    event.on("type-a", a2);
    event.fire("type-a", { foo: 1 });
    event.clear();
</script>

WebWorkers

importScripts("<module-dir>lib/WebModule.js");
importScripts("<module-dir>lib/EventHandler.js");

...

Node.js

require("<module-dir>lib/WebModule.js");
require("<module-dir>lib/EventHandler.js");

...

Package Sidebar

Install

npm i uupaa.eventhandler.js

Weekly Downloads

0

Version

0.0.3

License

MIT

Last publish

Collaborators

  • uupaa