41.73.0 • Published 2 years ago

@asledgehammer/pipewrench-events v41.73.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

PipeWrench-Events

Description

PipeWrench-Events is an extension for the PipeWrench library, packaging Project Zomboid's events in an API that takes advantage of the TypeScript environment. EventEmitters and EventConsumers , are provided as events and their associated consumer types for listeners.

Custom EventEmitters

import * as Events from 'PipeWrench-Events';

// Example consumer type
export type MusicTrackUpdateListener = (
    track: string,
    volume: number
) => void;

// Example EventEmitter.
const MusicTrackUpdate = new Events.EventEmitter<MusicTrackUpdateListener>('MusicTrackUpdate');

// Example implementation.
MusicTrackUpdate.addListener((track: string, volume: number) => {
  print(`Playing Track: ${track} (Volume: ${volume})`);
});

Setup

Notes

Support

npm.io

Discord Server

https://discord.gg/u3vWvcPX8f

If you like what I do and helped your community a lot, feel free to buy me a coffee! https://ko-fi.com/jabdoesthings https://www.paypal.com/paypalme/JabJabJab