Skip to content

Converts events to async iterable iterators(aka. async generators)

Notifications You must be signed in to change notification settings

CGQAQ/AsyncEventGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Converts events to async iterable iterators(aka. async generators)

Eventlistener 形式的 events 转换成 AsyncGenerator

Take Eventlistener form events, and transform into AsyncGenerator which can be then consume by for await of

// 将
// take
foo.on((event) => console.log(event));

// 变成
// and transform into
for await (const event of foo) {
  console.log(event);
}

示例

deno run mod.ts

tick 1
tick 2
received tick: 1
tick 3
received tick: 2
tick 4
received tick: 3
received tick: 4

About

Converts events to async iterable iterators(aka. async generators)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published