Skip to content

Commit

Permalink
Port to an ES6 class
Browse files Browse the repository at this point in the history
Using Prettier for formatting.
  • Loading branch information
jodal committed Oct 7, 2018
1 parent 4129726 commit 52e36e1
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 271 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion __tests__/mopidy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
Expand Down
Loading

0 comments on commit 52e36e1

Please sign in to comment.