@shughesuk/pipewrench-events
TypeScript icon, indicating that this package has built-in type declarations

41.73.6 • Public • Published

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

  • The documentation is transcribed from pzwiki.net

Support

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

Package Sidebar

Install

npm i @shughesuk/pipewrench-events

Weekly Downloads

4

Version

41.73.6

License

MIT

Unpacked Size

95.1 kB

Total Files

8

Last publish

Collaborators

  • shughesuk