diff options
author | 2022-08-21 20:34:31 +0800 | |
---|---|---|
committer | 2022-08-21 05:34:31 -0700 | |
commit | 3d8bc140aad4d7b035836037e94d688a11f0d7fb (patch) | |
tree | bf97478c8fb77af3e96088425fc59fd769e60365 /src/bun.js/javascript.zig | |
parent | d8f40e080da54ce2cd91eb40898cb86ef22a58a5 (diff) | |
download | bun-3d8bc140aad4d7b035836037e94d688a11f0d7fb.tar.gz bun-3d8bc140aad4d7b035836037e94d688a11f0d7fb.tar.zst bun-3d8bc140aad4d7b035836037e94d688a11f0d7fb.zip |
Add native EventEmitter (#1123)
* Add native EventEmitter
* add listeners, listenerCount and eventNames
* add global functions
* add Object to EventEmitter conversion
* fix upon review
Diffstat (limited to 'src/bun.js/javascript.zig')
-rw-r--r-- | src/bun.js/javascript.zig | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bun.js/javascript.zig b/src/bun.js/javascript.zig index ab256c588..04d4eaeac 100644 --- a/src/bun.js/javascript.zig +++ b/src/bun.js/javascript.zig @@ -813,6 +813,16 @@ pub const VirtualMachine = struct { .tag = ResolvedSource.Tag.@"node:buffer", }; }, + .@"node:events" => { + return ResolvedSource{ + .allocator = null, + .source_code = ZigString.init(""), + .specifier = ZigString.init("node:events"), + .source_url = ZigString.init("node:events"), + .hash = 0, + .tag = ResolvedSource.Tag.@"node:events", + }; + }, .@"node:fs/promises" => { return ResolvedSource{ .allocator = null, @@ -2768,6 +2778,7 @@ pub const HardcodedModule = enum { @"depd", @"detect-libc", @"node:buffer", + @"node:events", @"node:fs", @"node:fs/promises", @"node:http", @@ -2793,11 +2804,13 @@ pub const HardcodedModule = enum { .{ "bun:sqlite", HardcodedModule.@"bun:sqlite" }, .{ "depd", HardcodedModule.@"depd" }, .{ "detect-libc", HardcodedModule.@"detect-libc" }, + .{ "events", HardcodedModule.@"node:events" }, .{ "ffi", HardcodedModule.@"bun:ffi" }, .{ "fs", HardcodedModule.@"node:fs" }, .{ "http", HardcodedModule.@"node:http" }, .{ "module", HardcodedModule.@"node:module" }, .{ "node:buffer", HardcodedModule.@"node:buffer" }, + .{ "node:events", HardcodedModule.@"node:events" }, .{ "node:fs", HardcodedModule.@"node:fs" }, .{ "node:fs/promises", HardcodedModule.@"node:fs/promises" }, .{ "node:http", HardcodedModule.@"node:http" }, @@ -2830,13 +2843,14 @@ pub const HardcodedModule = enum { .{ "depd", "depd" }, .{ "detect-libc", "detect-libc" }, .{ "detect-libc/lib/detect-libc.js", "detect-libc" }, + .{ "events", "node:events" }, .{ "ffi", "bun:ffi" }, .{ "fs", "node:fs" }, .{ "fs/promises", "node:fs/promises" }, .{ "http", "node:http" }, .{ "module", "node:module" }, .{ "node:buffer", "node:buffer" }, - .{ "buffer", "node:buffer" }, + .{ "node:events", "node:events" }, .{ "node:fs", "node:fs" }, .{ "node:fs/promises", "node:fs/promises" }, .{ "node:http", "node:http" }, |