diff --git a/packages/controller/src/Controller.ts b/packages/controller/src/Controller.ts index 9092a744..c4b5fb12 100644 --- a/packages/controller/src/Controller.ts +++ b/packages/controller/src/Controller.ts @@ -241,12 +241,12 @@ export default class Controller { } // Handle subscriptions for all internal properties - this.subscriptions.handle(lib.HostUpdateEvent, undefined, event => event.update.id); - this.subscriptions.handle(lib.InstanceDetailsUpdateEvent, undefined, event => event.details.id); - this.subscriptions.handle(lib.InstanceSaveListUpdateEvent, undefined, event => event.instanceId); - this.subscriptions.handle(lib.ModPackUpdateEvent, undefined, event => event.modPack.id!); + this.subscriptions.handle(lib.HostUpdateEvent, event => event.update.id); + this.subscriptions.handle(lib.InstanceDetailsUpdateEvent, event => event.details.id); + this.subscriptions.handle(lib.InstanceSaveListUpdateEvent, event => event.instanceId); + this.subscriptions.handle(lib.ModPackUpdateEvent, event => event.modPack.id!); this.subscriptions.handle(lib.ModUpdateEvent); - this.subscriptions.handle(lib.UserUpdateEvent, undefined, event => event.user.name); + this.subscriptions.handle(lib.UserUpdateEvent, event => event.user.name); // Load plugins await this.loadPlugins(); diff --git a/packages/lib/src/subscriptions.ts b/packages/lib/src/subscriptions.ts index e8dff008..1127be05 100644 --- a/packages/lib/src/subscriptions.ts +++ b/packages/lib/src/subscriptions.ts @@ -121,11 +121,11 @@ export class SubscriptionController { * Allow clients to subscribe to an event by telling the subscription controller to accept them * Has an optional subscription update handler which is called when any client updates their subscription */ - handle(Event: EventClass, subscriptionUpdate?: SubscriptionRequestHandler, channelCategoriser?: SubscriptionChannelCategoriser): void; + handle(Event: EventClass, channelCategoriser?: SubscriptionChannelCategoriser, subscriptionUpdate?: SubscriptionRequestHandler,): void; handle( Event: EventClass, - subscriptionUpdate?: SubscriptionRequestHandler, channelCategoriser?: SubscriptionChannelCategoriser, + subscriptionUpdate?: SubscriptionRequestHandler, ) { const entry = Link._eventsByClass.get(Event); if (!entry) { diff --git a/test/integration/index.js b/test/integration/index.js index e9274609..360f0af9 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -34,19 +34,22 @@ class TestControl extends lib.Link { return; } this.send( - new lib.HostSetSubscriptionsRequest(true, []) + new lib.SubscriptionRequest(lib.HostUpdateEvent.name, true) ).catch(err => logger.error(`Error setting host subscriptions:\n${err.stack}`)); this.send( - new lib.InstanceDetailsSetSubscriptionsRequest(true, []) + new lib.SubscriptionRequest(lib.InstanceDetailsUpdateEvent.name, true) ).catch(err => logger.error(`Error setting instance subscriptions:\n${err.stack}`)); this.send( - new lib.InstanceSetSaveListSubscriptionsRequest(true, []) + new lib.SubscriptionRequest(lib.InstanceSaveListUpdateEvent.name, true) ).catch(err => logger.error(`Error setting save list subscriptions:\n${err.stack}`)); this.send( - new lib.ModSetSubscriptionsRequest(true, []) + new lib.SubscriptionRequest(lib.ModUpdateEvent.name, true) ).catch(err => logger.error(`Error setting mod subscriptions:\n${err.stack}`)); this.send( - new lib.UserSetSubscriptionsRequest(true, []) + new lib.SubscriptionRequest(lib.ModPackUpdateEvent.name, true) + ).catch(err => logger.error(`Error setting mod pack subscriptions:\n${err.stack}`)); + this.send( + new lib.SubscriptionRequest(lib.UserUpdateEvent.name, true) ).catch(err => logger.error(`Error setting user subscriptions:\n${err.stack}`)); });