OverwolfGameEventPackage
Electron APIs / gep / OverwolfGameEventPackage
Game Events Package interface.
Provides methods to query supported games and features, configure the required features for a game, and subscribe to game event and info update streams.
Extends
EventEmitter
Methods
[captureRejectionSymbol]()?
optional [captureRejectionSymbol]<K>(
error: Error,
event: string | symbol, ...
args: AnyRest): void;
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
error | Error |
event | string | symbol |
...args | AnyRest |
Returns
void
Inherited from
NodeJS.EventEmitter.[captureRejectionSymbol]
addListener()
addListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): this;
Alias for emitter.on(eventName, listener).
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
listener | (...args: any[]) => void |
Returns
this
Since
v0.1.26
Inherited from
NodeJS.EventEmitter.addListener;
emit()
emit<K>(eventName: string | symbol, ...args: AnyRest): boolean;
Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments
to each.
Returns true if the event had listeners, false otherwise.
import { EventEmitter } from "node:events";
const myEmitter = new EventEmitter();
// First listener
myEmitter.on("event", function firstListener() {
console.log("Helloooo! first listener");
});
// Second listener
myEmitter.on("event", function secondListener(arg1, arg2) {
console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
});
// Third listener
myEmitter.on("event", function thirdListener(...args) {
const parameters = args.join(", ");
console.log(`event with parameters ${parameters} in third listener`);
});
console.log(myEmitter.listeners("event"));
myEmitter.emit("event", 1, 2, 3, 4, 5);
// Prints:
// [
// [Function: firstListener],
// [Function: secondListener],
// [Function: thirdListener]
// ]
// Helloooo! first listener
// event with parameters 1, 2 in second listener
// event with parameters 1, 2, 3, 4, 5 in third listener
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
...args | AnyRest |
Returns
boolean
Since
v0.1.26
Inherited from
NodeJS.EventEmitter.emit;
eventNames()
eventNames(): (string | symbol)[];
Returns an array listing the events for which the emitter has registered
listeners. The values in the array are strings or Symbols.
import { EventEmitter } from "node: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
(string | symbol)[]
Since
v6.0.0
Inherited from
NodeJS.EventEmitter.eventNames;
getFeatures()
getFeatures(gameId: number): Promise<string[]>;
Returns an array of supported Game Event Features for a game.
Parameters
| Parameter | Type | Description |
|---|---|---|
gameId | number | Game ID of the targeted game. |
Returns
Promise<string[]>
Promise resolving to an array of supported game features.
getInfo()
getInfo(gameId: number): Promise<any>;
Returns the target game's current Game Info.
Parameters
| Parameter | Type | Description |
|---|---|---|
gameId | number | Game ID of the targeted game. |
Returns
Promise<any>
Promise resolving to the targeted game's current Game Info.
getMaxListeners()
getMaxListeners(): number;
Returns the current max listener value for the EventEmitter which is either
set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.
Returns
number
Since
v1.0.0
Inherited from
NodeJS.EventEmitter.getMaxListeners;
getSupportedGames()
getSupportedGames(): Promise<object[]>;
Returns an array of Game Events supported games.
Returns
Promise<object[]>
Promise resolving to the supported games.
listenerCount()
listenerCount<K>(eventName: string | symbol, listener?: Function): number;
Returns the number of listeners listening for the event named eventName.
If listener is provided, it will return how many times the listener is found
in the list of the listeners of the event.
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type | Description |
|---|---|---|
eventName | string | symbol | The name of the event being listened for |
listener? | Function | The event handler function |
Returns
number
Since
v3.2.0
Inherited from
NodeJS.EventEmitter.listenerCount;
listeners()
listeners<K>(eventName: string | symbol): Function[];
Returns a copy of the array of listeners for the event named eventName.
server.on("connection", (stream) => {
console.log("someone connected!");
});
console.log(util.inspect(server.listeners("connection")));
// Prints: [ [Function] ]
Type Parameters
| Type Parameter |
|---|
K |
Parameters
| Parameter | Type |
|---|---|
eventName | string | symbol |
Returns
Function[]
Since
v0.1.26
Inherited from
NodeJS.EventEmitter.listeners;