Gathering detailed insights and metrics for typed-event-dispatcher
Gathering detailed insights and metrics for typed-event-dispatcher
npm install typed-event-dispatcher
Typescript
Module System
Node Version
NPM Version
64.4
Supply Chain
97.2
Quality
76
Maintenance
100
Vulnerability
100
License
TypeScript (99.3%)
Shell (0.7%)
Total Downloads
7,232
Last Day
5
Last Week
19
Last Month
113
Last Year
1,862
3 Stars
632 Commits
3 Watching
2 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
1.11.6
Package Id
typed-event-dispatcher@1.11.6
Unpacked Size
13.70 kB
Size
4.71 kB
File Count
9
NPM Version
9.2.0
Node Version
19.3.0
Cumulative downloads
Total Downloads
Last day
66.7%
5
Compared to previous day
Last week
-70.3%
19
Compared to previous week
Last month
54.8%
113
Compared to previous month
Last year
75.3%
1,862
Compared to previous year
Strongly-typed events that can be publicly listened but internally-only dispatched.
A lightweight, fully-tested and dependency-free lib made for Typescript (see live example) and JavaScript (see live example) codebases.
This is intended to be used with Classes. If you prefer using only Functions, please check create-pubsub.
1npm install typed-event-dispatcher
1// Import as an ES Module. 2import { TypedEventDispatcher } from "typed-event-dispatcher";
1// Or require as a CommonJS Module. 2const { TypedEventDispatcher } = require("typed-event-dispatcher");
1// Or import it from URL. 2import { TypedEventDispatcher } from "https://esm.sh/typed-event-dispatcher";
1<!-- Or use it directly in the browser. --> 2<script src="https://unpkg.com/typed-event-dispatcher"></script> 3<script> 4 const { TypedEventDispatcher } = window["typed-event-dispatcher"]; 5</script>
1class Counter { 2 // 1️⃣ Create a private event dispatcher. 3 private onCountIncreasedDispatcher = new TypedEventDispatcher<number>(); 4 5 // 2️⃣ Create a public event getter. 6 public get onCountIncreased() { 7 return this.onCountIncreasedDispatcher.getter; 8 } 9 10 public increaseCountOncePerSecond() { 11 setInterval(() => { 12 this.increaseCount(); 13 14 // 3️⃣ Dispatch the event so listeners can react to it. 15 this.onCountIncreasedDispatcher.dispatch(this.count); 16 }, 1000); 17 } 18 19 private count = 0; 20 21 private increaseCount() { 22 this.count++; 23 } 24} 25 26class Example { 27 private counter = new Counter(); 28 29 public start() { 30 console.log("Starting count..."); 31 32 // 4️⃣ Listen to events dispatched by other classes. 33 this.counter.onCountIncreased.addListener((count) => { 34 console.log(`Count increased to ${count}.`); 35 }); 36 37 this.counter.increaseCountOncePerSecond(); 38 } 39} 40 41new Example().start();
For more details about how to use this lib, please refer to the Usage Overview.
Check also the Online Documentation. Or generate it locally by running npm run docs
.
Although all you need to know is only two definitions:
No vulnerabilities found.
Reason
14 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More