shimizacken / neutron

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

neutron

neutron

Usage example

const colorsNeutron = createNeutron<string>();

const abandonWatcher = colorsNeutron.watch((next, previous) => {
  console.log("next", next, "previous", previous);
});

colorsNeutron.emit("red"); // next red previous undefined
colorsNeutron.emit("green"); // next green previous red

abandonWatcher();

colorsNeutron.emit("orange"); // no emit

numbersNeutron.watch((num) => {
  console.log(num);
});

About


Languages

Language:TypeScript 75.7%Language:HTML 14.1%Language:CSS 8.6%Language:JavaScript 1.6%