UNPKG
yj-tiny-signal
Version:
latest (1.0.6)
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
A tiny event dispatcher for JavaScript and TypeScript
yj-tiny-signal
/
build
/
index.js
3 lines
(2 loc)
•
249 B
JavaScript
View Raw
1
2
3
var
t=
class
{listeners;active=!
0
;
constructor
(
){
this
.
listeners
=
new
Set
}
add
(
e
){
this
.
listeners
.
add
(e)}
remove
(
e
){
this
.
listeners
.
delete
(e)}
dispatch
(
e
){
this
.
active
&&
this
.
listeners
.
forEach
(
i
=>
{
i
(e)})}};
export
{t
as
Signal
};
//# sourceMappingURL=index.js.map