js: Upgrade when.js from 1.8.1 to 2.0.0
This commit is contained in:
parent
82e94f00fe
commit
bc78a65fff
@ -71,7 +71,7 @@ v0.13.0 (in development)
|
||||
|
||||
- Upgrade Mopidy.js' build system Grunt from 0.3 to 0.4.
|
||||
|
||||
- Upgrade Mopidy.js' dependencies when.js from 1.6.1 to 1.8.1.
|
||||
- Upgrade Mopidy.js' dependencies when.js from 1.6.1 to 2.0.0.
|
||||
|
||||
- Expose :meth:`mopidy.core.Core.get_uri_schemes` to HTTP clients. It is
|
||||
available through Mopidy.js as ``mopidy.getUriSchemes()``.
|
||||
|
||||
@ -24,6 +24,7 @@ module.exports = function (grunt) {
|
||||
files: {
|
||||
"<%= meta.files.concat %>": [
|
||||
"lib/bane-*.js",
|
||||
"lib/when-define-shim.js",
|
||||
"lib/when-*.js",
|
||||
"src/mopidy.js"
|
||||
]
|
||||
|
||||
12
js/buster.js
12
js/buster.js
@ -2,7 +2,11 @@ var config = module.exports;
|
||||
|
||||
config.browser_tests = {
|
||||
environment: "browser",
|
||||
libs: ["lib/**/*.js"],
|
||||
libs: [
|
||||
"lib/bane-*.js",
|
||||
"lib/when-define-shim.js",
|
||||
"lib/when-*.js"
|
||||
],
|
||||
sources: ["src/**/*.js"],
|
||||
testHelpers: ["test/**/*-helper.js"],
|
||||
tests: ["test/**/*-test.js"]
|
||||
@ -10,7 +14,11 @@ config.browser_tests = {
|
||||
|
||||
config.node_tests = {
|
||||
environment: "node",
|
||||
libs: ["lib/**/*.js"],
|
||||
libs: [
|
||||
"lib/bane-*.js",
|
||||
"lib/when-define-shim.js",
|
||||
"lib/when-*.js"
|
||||
],
|
||||
sources: ["src/**/*.js"],
|
||||
testHelpers: ["test/**/*-helper.js"],
|
||||
tests: ["test/**/*-test.js"]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
11
js/lib/when-define-shim.js
Normal file
11
js/lib/when-define-shim.js
Normal file
@ -0,0 +1,11 @@
|
||||
if (typeof window !== "undefined") {
|
||||
window.define = function (factory) {
|
||||
try {
|
||||
delete window.define;
|
||||
} catch (e) {
|
||||
window.define = void 0; // IE
|
||||
}
|
||||
window.when = factory();
|
||||
};
|
||||
window.define.amd = {};
|
||||
}
|
||||
@ -16,7 +16,7 @@
|
||||
"dependencies": {
|
||||
"bane": "~0.4.0",
|
||||
"faye-websocket": "~0.4.4",
|
||||
"when": "~1.8.1"
|
||||
"when": "~2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"buster": "~0.6.12",
|
||||
|
||||
@ -242,7 +242,7 @@ Mopidy.prototype._handleEvent = function (eventMessage) {
|
||||
};
|
||||
|
||||
Mopidy.prototype._getApiSpec = function () {
|
||||
this._send({method: "core.describe"})
|
||||
return this._send({method: "core.describe"})
|
||||
.then(this._createApi.bind(this), this._handleWebSocketError)
|
||||
.then(null, this._handleWebSocketError);
|
||||
};
|
||||
|
||||
@ -610,16 +610,16 @@ buster.testCase("Mopidy", {
|
||||
assert.calledOnceWith(stub);
|
||||
},
|
||||
|
||||
"gets Api description from server and calls _createApi": function () {
|
||||
"gets Api description from server and calls _createApi": function (done) {
|
||||
var methods = {};
|
||||
var sendStub = this.stub(this.mopidy, "_send");
|
||||
sendStub.returns(when.resolve(methods));
|
||||
var _createApiStub = this.stub(this.mopidy, "_createApi");
|
||||
|
||||
this.mopidy._getApiSpec();
|
||||
|
||||
assert.calledOnceWith(sendStub, {method: "core.describe"});
|
||||
assert.calledOnceWith(_createApiStub, methods);
|
||||
this.mopidy._getApiSpec().then(done(function () {
|
||||
assert.calledOnceWith(sendStub, {method: "core.describe"});
|
||||
assert.calledOnceWith(_createApiStub, methods);
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
4
mopidy/frontends/http/data/mopidy.min.js
vendored
4
mopidy/frontends/http/data/mopidy.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user