UNPKG

entry-empty-emitter

Version:

Extension of node event emitter. Providers information about entry and exit of key.

28 lines (26 loc) 760 B
<html> <head> <script src="./EntryEmptyEmitterBrowserified.js"/> </head> <input id="text" type="text"> <button id="buttonAdd" onclick="btnClickAdd()">Add</button> <button id="buttonRemove" onclick="btnClickRemove()">Remove</button> </body> <script> var myEntryExitListener = new EntryEmptyEmitter(); myEntryExitListener.on('entry', function(data){ console.log('Entry Triggered', data) }) myEntryExitListener.on('empty', function(data){ console.log('exit Triggered', data) }) function btnClickAdd(){ var val = document.querySelector('#text').value; myEntryExitListener.add(val); } function btnClickRemove(){ var val = document.querySelector('#text').value; myEntryExitListener.remove(val); } </script> </html>