Skip to content
This repository was archived by the owner on Mar 6, 2020. It is now read-only.

Commit 7ee9d57

Browse files
committed
convert waitlist hooks to plugin
1 parent 28de2c1 commit 7ee9d57

3 files changed

Lines changed: 21 additions & 13 deletions

File tree

src/ExtPlug.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import EmojiDataPlugin from './plugins/EmojiDataPlugin';
1818
import TooltipsPlugin from './plugins/TooltipsPlugin';
1919
import GuestPlugin from './plugins/GuestPlugin';
2020
import SocketEventsPlugin from './plugins/SocketEventsPlugin';
21+
import WaitlistEventsPlugin from './plugins/WaitlistEventsPlugin';
2122

2223
import * as _package from './package';
2324

@@ -87,7 +88,8 @@ const ExtPlug = Plugin.extend({
8788
new UserClassesPlugin('extplug:user-classes', this),
8889
new EmojiDataPlugin('extplug:emoji-data', this),
8990
new TooltipsPlugin('extplug:tooltips', this),
90-
new SocketEventsPlugin('extplug:socket-events', this)
91+
new SocketEventsPlugin('extplug:socket-events', this),
92+
new WaitlistEventsPlugin('extplug:waitlist-events', this)
9193
];
9294

9395
this._guest = new GuestPlugin('extplug:guest', this);

src/hooks/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import * as waitlistHook from './waitlist';
21
import * as apiEarlyHook from './api-early';
32
import * as playbackHook from './playback';
43
import * as settingsHook from './settings';
54
import * as popoutStyleHook from './popout-style';
65

76
export default [
8-
waitlistHook,
97
apiEarlyHook,
108
playbackHook,
119
settingsHook,
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Plugin from '../Plugin';
12
import booth from 'plug/models/booth';
23
import waitlist from 'plug/collections/waitlist';
34
import users from 'plug/collections/users';
@@ -22,14 +23,21 @@ function onChange() {
2223
});
2324
}
2425

25-
export function install() {
26-
booth.on('change:waitingDJs', onChange);
27-
extend(API, events);
28-
};
26+
const WaitlistEvents = Plugin.extend({
27+
name: 'Waitlist Events',
28+
description: 'Adds events for when users join or leave the waitlist.',
2929

30-
export function uninstall() {
31-
booth.off('change:waitingDJs', onChange);
32-
Object.keys(events).forEach(n => {
33-
delete API[n];
34-
});
35-
};
30+
enable() {
31+
booth.on('change:waitingDJs', onChange);
32+
extend(API, events);
33+
},
34+
35+
disable() {
36+
booth.off('change:waitingDJs', onChange);
37+
Object.keys(events).forEach(n => {
38+
delete API[n];
39+
});
40+
}
41+
});
42+
43+
export default WaitlistEvents;

0 commit comments

Comments
 (0)