Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit 2b4fa09

Browse files
committed
Updated to work with new client lib.
1 parent 57e0e04 commit 2b4fa09

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

index.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,17 @@
33
// (really, it's just the browser client with some Node libraries to supply fake
44
// browser globals.)
55

6-
// Do aliases to get around Node modules.
7-
const nymphPath = require.resolve('nymph-client').replace(/lib\/Nymph(?:\.js)?$/, '');
8-
const alias = require('module-alias');
9-
alias.addAliases({
10-
'Nymph': nymphPath + 'lib/Nymph',
11-
'NymphEntity': nymphPath + 'lib/Entity',
12-
'NymphPubSub': nymphPath + 'lib/PubSub',
13-
'Entity': nymphPath + 'lib/Entity',
14-
'PubSub': nymphPath + 'lib/PubSub'
15-
});
16-
176
// Nymph expects the global browser objects XMLHttpRequest and WebSocket.
18-
global.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
7+
global.XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
198
global.WebSocket = require('websocket').w3cwebsocket;
209
// And sometimes we need the XHR object to support cookies.
2110
const enableCookies = () => {
22-
const xhrc = require("xmlhttprequest-cookie");
11+
const xhrc = require('xmlhttprequest-cookie');
2312
global.XMLHttpRequest = xhrc.XMLHttpRequest;
2413
};
2514

26-
const Nymph = require('Nymph').Nymph;
27-
const PubSub = require('NymphPubSub').PubSub;
15+
const nymphClient = require('nymph-client');
16+
const {Nymph, PubSub} = nymphClient;
2817

2918
// Make a shortcut for PubSub init.
3019
const _init = Nymph.init;
@@ -35,4 +24,4 @@ Nymph.init = (nymphOptions) => {
3524
}
3625
};
3726

38-
module.exports = {Nymph, enableCookies};
27+
module.exports = {Nymph, PubSub, enableCookies, ...nymphClient};

package-lock.json

Lines changed: 4 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nymph-client-node",
3-
"version": "2.0.2",
3+
"version": "3.0.0-beta.1",
44
"description": "A client wrapper for using Nymph in Node.js.",
55
"main": "index.js",
66
"scripts": {
@@ -20,8 +20,7 @@
2020
},
2121
"homepage": "https://github.com/sciactive/nymph-client-node#readme",
2222
"dependencies": {
23-
"module-alias": "^2.0.6",
24-
"nymph-client": "^3",
23+
"nymph-client": "^4.0.0-beta.11",
2524
"websocket": "^1.0.25",
2625
"xmlhttprequest": "^1.8.0",
2726
"xmlhttprequest-cookie": "^0.9.6"

0 commit comments

Comments
 (0)