Skip to content
Permalink
Browse files

Port to an ES6 class

Using Prettier for formatting.
  • Loading branch information...
jodal committed Oct 7, 2018
1 parent 4129726 commit 52e36e19a185a868b8bf50e443a3b7bd14d50853
Showing with 272 additions and 271 deletions.
  1. +17 −8 README.md
  2. +1 −1 __tests__/mopidy.test.js
  3. +254 −262 src/mopidy.js
@@ -9,38 +9,34 @@ frontend or from npm. The library makes Mopidy's core API available from the
browser or a Node.js environment, using JSON-RPC messages over a WebSocket to
communicate with Mopidy.


## Getting it for browser use

Regular and minified versions of Mopidy.js, ready for use, is available from
the project's
[GitHub release page](https://github.com/mopidy/mopidy.js/releases).


## Getting it for Node.js use

If you want to use Mopidy.js from Node.js instead of a browser, you can install
Mopidy.js using npm:

npm install mopidy

After npm completes, you can import Mopidy.js using ``require()``:
After npm completes, you can import Mopidy.js using `require()`:

var Mopidy = require("mopidy");


## Using the library

See the [Mopidy.js documentation](https://docs.mopidy.com/en/latest/api/js/).


## Building from source

1. Install [Node.js](https://nodejs.org/) and npm. If you're running Ubuntu:
1. Install [Node.js](https://nodejs.org/) and npm. If you're running Ubuntu:

sudo apt-get install nodejs-legacy npm

2. Enter the source directory, and install all dependencies:
2. Enter the source directory, and install all dependencies:

npm install

@@ -64,9 +60,22 @@ To run other [grunt](https://gruntjs.com/) targets which isn't predefined in

PATH=./node_modules/.bin:$PATH grunt foo


## Changelog

### 1.0.0 (UNRELEASED)

- **Backwards incompatible:** The `Mopidy` class can no longer be instantiated
without the `new` keyword.

Example of how to upgrade existing code:

```js
// Change from this:
const mopidy = Mopidy(...);
// To this:
const Mopidy = new Mopidy(...);
```

### 0.5.0 (2015-01-31)

- Reexport When.js library as `Mopidy.when`, to make it easily available to
@@ -90,7 +90,7 @@ describe("constructor", () => {
expect(warn).not.toBeCalled();
});

test("works without 'new' keyword", () => {
test.skip("works without 'new' keyword", () => {
const mopidy = Mopidy({
callingConvention: "by-position-or-by-name",
});

0 comments on commit 52e36e1

Please sign in to comment.
You can’t perform that action at this time.