Skip to content
/ saga Public

⛰️ functional event emitter / pubsub in deno.

License

Notifications You must be signed in to change notification settings

yandif/saga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

saga

⛰️ functional event emitter / pubsub in deno.

Useage

import saga from "https://deno.land/x/saga/mod.ts"

const { on, emit } = saga();
const arr = [];
const fn = (arr, ...args) => {
  arr.push(...args);
};
const off = on("message", fn);

emit("message", arr, "⛰️");
console.log(arr); //==> ["⛰️"]

off();
emit("message", arr, "⛰️");
console.log(arr); //==> ["⛰️"]

on("*", () => {
  console.log("⛰️");
});
emit("any"); //==> ⛰️

About

⛰️ functional event emitter / pubsub in deno.

Resources

License

Stars

Watchers

Forks

Packages

No packages published