UNPKG

wam-extensions

Version:

Unofficial extensions to the Web Audio Module 2 API

22 lines (21 loc) 604 B
// Multiplayer extension enables plugins to understand multiple users within the session. export class MultiplayerExtension { constructor(userState) { this.delegates = new Map(); this.userState = userState; } register(pluginId, delegate) { if (delegate) { this.delegates.set(pluginId, delegate); } else { this.delegates.delete(pluginId); } } updateUsers(userState) { this.userState = userState; for (let d of this.delegates.values()) { d.userListUpdated(userState); } } }