call-func
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

Call Function

Event addEventListener wrapper

  • subscribe

HTML

<button>Click</button>

JS

import { register, cleanAllRegister } from "call-func";
const oReg = register(document.querySelector("button"));
const regId = oReg.addEventListener("click", () => {
  console.log("click");
});
  • unsubscribe by id
// clean one
oReg.removeEventListener(regId);

// clean one dom events by type.
oReg.cleanAll("click");

// clean one dom all events.
oReg.cleanAll();

// clean events which regist by this library.
cleanAllRegister();

Package Sidebar

Install

npm i call-func

Weekly Downloads

530

Version

0.4.0

License

MIT

Unpacked Size

28.9 kB

Total Files

32

Last publish

Collaborators

  • hillliu