-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathaffordances.js
64 lines (52 loc) · 1.56 KB
/
affordances.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Module dependencies
*/
var Err = require('./errors');
/**
* Compatibility / warning affordances
*
* Run upon initialization, this logic adds stub methods to the main module
* to catch incorrect usage for developers incorrectly using the JavaScript SDK
* on the server (rather than the proper docs for this Node.js module)
*
* > Note: Methods in the JavaScript SDK are covered here w/
* > explicit errors to avoid confusion about what's possible from
* > the server.
*/
module.exports = function ensureProperUsage () {
this.init = function() {
throw Err.notCompatible('init');
};
this.login = function() {
throw Err.notCompatible('login');
};
this.logout = function() {
throw Err.notCompatible('logout');
};
this.getLoginStatus = function() {
throw Err.notCompatible('getLoginStatus');
};
this.api = function() {
throw Err.notCompatible('api');
};
function playerNotCompatible() {
throw Err.notCompatible('player');
}
this.player = playerNotCompatible;
this.player.play = playerNotCompatible;
this.player.pause = playerNotCompatible;
this.player.next = playerNotCompatible;
this.player.prev = playerNotCompatible;
this.player.setVolume = playerNotCompatible;
this.player.seek = playerNotCompatible;
this.player.playTracks = playerNotCompatible;
this.player.playAlbum = playerNotCompatible;
this.player.playPlaylist = playerNotCompatible;
this.player.playRadio = playerNotCompatible;
this.player.playSmartRadio = playerNotCompatible;
this.Event = {
subscribe: function() {
throw Err.notCompatible('Event.subscribe');
}
};
};