Commit Graph

76 Commits

Author SHA1 Message Date
Stein Magnus Jodal
d15c7d0797 js: Log warning if calling convention is not explicitly set 2014-06-20 11:16:46 +02:00
Stein Magnus Jodal
c5028a8576 js: Fix console setup, allow mocking of the console 2014-06-20 11:16:15 +02:00
Stein Magnus Jodal
56ad78c333 docs: Add more details on Mopidy.js calling convention 2014-06-19 23:57:35 +02:00
Stein Magnus Jodal
225f41f999 js: Add by-position-or-by-name calling convention
Fixes #699
2014-06-18 23:27:07 +02:00
Stein Magnus Jodal
149287c06a js: Don't include params if method is called without arguments 2014-06-18 22:22:42 +02:00
Stein Magnus Jodal
858a6977df js: Add callingConvention setting
For now it defaults to the existing behavior "by-position-only" and changing it
has no effect.
2014-06-17 20:57:55 +02:00
Stein Magnus Jodal
198bd8af6c js: Use .catch() to simplify error handling 2014-06-17 20:41:35 +02:00
Stein Magnus Jodal
9ed17b222a js: Test existing call convention 2014-06-17 20:26:45 +02:00
Stein Magnus Jodal
d9d8d06ff4 js: Release Mopidy.js v0.3.0 2014-06-16 23:11:39 +02:00
Stein Magnus Jodal
64d39f98d3 js: Update package.json with all recommended fields 2014-06-16 23:11:15 +02:00
Stein Magnus Jodal
785c469ec4 js: Include package version in built files 2014-06-16 23:10:39 +02:00
Stein Magnus Jodal
13205bee5f js: Connect to /mopidy/ws without trailing slash
This is the recommended URL since the switch to Tornado as web server.
2014-06-15 23:43:44 +02:00
Stein Magnus Jodal
ee9d19fc6e js: Fix unhandled promise rejection in test 2014-06-15 23:43:44 +02:00
Stein Magnus Jodal
30471bab74 js: Add ServerError and ConnectionError types 2014-06-15 23:43:43 +02:00
Stein Magnus Jodal
026fdb38a3 js: Reject promises using Error objects
This is recommended to get proper stack traces, according to
https://github.com/cujojs/when/blob/master/docs/api.md#a-note-on-javascript-errors.

The new Error objects has the exact same properties as the objects we used to
reject promises previously, thus this should be fully backwards compatible, but
improve debuggability.
2014-06-15 23:43:39 +02:00
Stein Magnus Jodal
4a609ce95d js: Add TODOs for rejecting promises with Error
This is recommended to get proper stack traces, according to
https://github.com/cujojs/when/blob/master/docs/api.md#a-note-on-javascript-errors
2014-06-15 12:31:52 +02:00
Stein Magnus Jodal
cb04b81bf4 js: Simplify _send() rejections 2014-06-15 12:16:39 +02:00
Stein Magnus Jodal
eec51a1e83 js: Upgrade to when.js 3 2014-06-15 12:14:14 +02:00
Stein Magnus Jodal
c40c70a90b js: Update dev dependencies 2014-06-15 10:16:39 +02:00
Stein Magnus Jodal
0167986b98 js: Pass grunt-browserify errors on 2014-06-15 10:12:23 +02:00
Stein Magnus Jodal
7b71e64553 js: Update test deps 2014-06-12 20:52:53 +02:00
Stein Magnus Jodal
6cbb15bd15 js: Update dev env instructions 2014-06-12 20:47:15 +02:00
Stein Magnus Jodal
d12381d7d4 docs: Move Mopidy.js docs to its own page 2014-05-15 21:10:36 +02:00
Stein Magnus Jodal
a7d38df853 js: Release Mopidy.js 0.2.0 to npm 2014-01-04 00:13:19 +01:00
Stein Magnus Jodal
aa8406e309 js: Remove unused when-define-shim.js 2014-01-04 00:10:48 +01:00
Stein Magnus Jodal
c7e96cf992 js: Update all dependencies 2014-01-04 00:05:31 +01:00
Stein Magnus Jodal
ac7ff2744d js: Update Node instructions, add changelog 2014-01-03 23:59:39 +01:00
Stein Magnus Jodal
a5bbe248cc Merge remote-tracking branch 'connrs/browserify' into develop
Conflicts:
	js/Gruntfile.js
2014-01-03 23:47:57 +01:00
Paul Connolley
32252cb100 Updated npm version to 0.2.0
After using this in our live mopidy system for the last 2 weeks, I am
quite happy about the stability of the release. I've updated the
package.json file as it makes sense to incorporate this in to my final
commit for issue #609
2014-01-03 11:28:03 +00:00
Stein Magnus Jodal
621aff22c9 http: Move mopidy.{frontends => }.http 2013-12-31 14:04:25 +01:00
Paul Connolley
26b8490672 Updated the test process for mopidy.js
Following on from the previous issue #609 commits, I have updated the
build process to cater to the fact that the files are no longer
available to test in the browser environment.

2 new browserify tasks build the mopidy.js file and then when.js file
(available in node_modules.) These files are placed in test/lib/ (This
directory has been added to the .gitignore file) prior to the running of
the buster tests. As these files are ignored in the .gitignore, this
will prevent them from being committed to git and also prevent them from
being packaged up to npm.

Once the tests have completed, the main browserify task will run to
build the official browser release.
2013-12-17 16:52:35 +00:00
Paul Connolley
a83b71239b Update test so that it correctly requires the mopidy module
As part of issue #609, the require statement in mopidy-test.js should
have been updated as the API to require mopidy has changed from:

    require('mopidy').Mopidy;

to:

    require('mopidy');
2013-12-17 08:57:44 +00:00
Paul Connolley
418e5689dc Preliminary commit for browserify compatibility
This is the first stage of my commits for issue #609 that will make the
npm module browserify friendly and browser friendly.

The grunt-browserify module has been introduced to replace
grunt-contrib-concat. Browserify automatically concatenates files and so
there is no need for a concat step.

The faye-websocket module was problematic so I moved the require out to
a separate module within the lib directory. The websocket module is a
folder containing a package.json, directing library consumers to the
entry point that is appropriate for their environment. Browserify picks
browser.js (which simply returns an object holding window.WebSocket)
while everyone else gets the faye-websocket module.

In addition, as browserify handles all the requires, there's no need to
detect the environment or include any pre-built modules. I've removed
the pre-built when and faye-websocket files in favour of letting
browserify use the modules within node_modules. This should make it
easier to maintain dependencies in future versions of this library.

One side effect of this browserify compatibility is that, in order to
allow the library to be globally available in the browser as `Mopidy`,
I've had to set Mopidy as the exported object instead of as a key of the
exported object. To elaborate further, the current API would be like the
following:

    var Mopidy = require('mopidy').Mopidy;

However, with this change, the API would be like this:

    var Mopidy = require('mopidy');

I'm not sure whether this would be an issue and so I think it's worth
discussing further. It's possible that node developers won't have a
problem but, if they did, a potential workaround within the mopidy.js
file would be:

   Mopidy.Mopidy = Mopidy;

This would allow developers to choose either of the following:

    var Mopidy = require('mopidy');
    var Mopidy = require('mopidy').Mopidy;

Could be a little odd to do this though

When testing the browserify build, I noticed a strange error thrown when
making the initial websocket connection. I managed to track it down to
an IE 'feature' that crops up when you alias in-built functions. In
particular, the when module was aliasing setImmediate to an internal
function (nextTick.) In a newer version of when, the function is
instead aliased to the browserify process.nextTick. This works well
because substack already had that covered.

With when@2.7.0, IE11 appears to be working well. IE10 is still pending
a test.
2013-12-15 01:52:24 +00:00
Stein Magnus Jodal
31d42f743b js: Bump npm package version 2013-09-17 00:42:09 +02:00
Stein Magnus Jodal
655915da9d js: Upgrade devDependencies 2013-09-17 00:41:05 +02:00
Stein Magnus Jodal
1082d41777 js: Upgrade faye-websocket from 0.4.4 to 0.7.0 2013-09-17 00:40:42 +02:00
Stein Magnus Jodal
ba64c7f15a js: Upgrade When.js from 2.0.0 to 2.4.0 2013-09-17 00:39:59 +02:00
Stein Magnus Jodal
94079be1c6 js: Upgrade Bane from 0.4.0 to 1.0.0 2013-09-17 00:39:58 +02:00
Stein Magnus Jodal
95c8077135 docs: nodejs deb now includes npm 2013-08-04 11:24:00 +02:00
Stein Magnus Jodal
dc7289ba83 docs: Fix formatting of code examples in lists 2013-08-04 11:22:36 +02:00
Stein Magnus Jodal
bf7651ae7e js: Update dev dependencies 2013-05-13 19:25:53 +02:00
Stein Magnus Jodal
b22cba63b8 js: Use 'npm start' to run 'grunt watch' 2013-05-13 19:25:34 +02:00
Stein Magnus Jodal
29ac5f0cc7 js: Update link to HTTP API docs 2013-04-12 11:30:36 +02:00
Stein Magnus Jodal
22fbd9eff8 js: Bump minor version 2013-03-31 14:09:32 +02:00
Stein Magnus Jodal
bc78a65fff js: Upgrade when.js from 1.8.1 to 2.0.0 2013-03-31 14:09:32 +02:00
Stein Magnus Jodal
5e374350f5 js: Add more metadata to package.json for npm publishing 2013-03-30 01:34:22 +01:00
Stein Magnus Jodal
74b4fdc7ee js: Make test suite run on Node.js using faye-websocket 2013-03-29 13:51:28 +01:00
Stein Magnus Jodal
5e29647897 js: Remove redundant config not working on Node 0.10 2013-03-28 23:53:29 +01:00
Stein Magnus Jodal
cf2d22c281 js: Upgrade when.js from 1.6.1 to 1.8.1 2013-03-12 23:39:14 +01:00
Stein Magnus Jodal
51b782e926 js: Migrate Grunt from 0.3 to 0.4 2013-03-12 23:28:54 +01:00