Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/ext/node/polyfills/events.ts>default#eventNames

A modern runtime for JavaScript and TypeScript.
Go to Latest
method default.prototype.eventNames
import { default } from "https://deno.land/x/deno@v1.39.0/ext/node/polyfills/events.ts";

Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

const EventEmitter = require('events');
const myEE = new EventEmitter();
myEE.on('foo', () => {});
myEE.on('bar', () => {});

const sym = Symbol('symbol');
myEE.on(sym, () => {});

console.log(myEE.eventNames());
// Prints: [ 'foo', 'bar', Symbol(symbol) ]

Returns

Array<string | symbol>