Comparing version 2.3.0 to 2.3.1
@@ -765,3 +765,3 @@ /*! osc.js 2.3.0, Copyright 2019 Colin Clark | github.com/colinbdclark/osc.js */ | ||
"use strict"; | ||
osc.firePacketEvents = function(e, t, r, n) { | ||
osc.supportsSerial = !1, osc.firePacketEvents = function(e, t, r, n) { | ||
t.address ? e.emit("message", t, r, n) : osc.fireBundleEvents(e, t, r, n); | ||
@@ -867,5 +867,7 @@ }, osc.fireBundleEvents = function(e, t, r, n) { | ||
osc.WebSocketPort.setupSocketForBinary(this.socket); | ||
var e = this; | ||
var t = this; | ||
this.socket.onopen = function() { | ||
e.emit("open", e.socket); | ||
t.emit("open", t.socket); | ||
}, this.socket.onerror = function(e) { | ||
t.emit("error", e); | ||
}; | ||
@@ -876,4 +878,2 @@ }, e.listen = function() { | ||
t.emit("data", e.data, e); | ||
}, this.socket.onerror = function(e) { | ||
t.emit("error", e); | ||
}, this.socket.onclose = function(e) { | ||
@@ -880,0 +880,0 @@ t.emit("close", e); |
@@ -765,3 +765,3 @@ /*! osc.js 2.3.0, Copyright 2019 Colin Clark | github.com/colinbdclark/osc.js */ | ||
"use strict"; | ||
osc.firePacketEvents = function(e, t, r, n) { | ||
osc.supportsSerial = !1, osc.firePacketEvents = function(e, t, r, n) { | ||
t.address ? e.emit("message", t, r, n) : osc.fireBundleEvents(e, t, r, n); | ||
@@ -867,5 +867,7 @@ }, osc.fireBundleEvents = function(e, t, r, n) { | ||
osc.WebSocketPort.setupSocketForBinary(this.socket); | ||
var e = this; | ||
var t = this; | ||
this.socket.onopen = function() { | ||
e.emit("open", e.socket); | ||
t.emit("open", t.socket); | ||
}, this.socket.onerror = function(e) { | ||
t.emit("error", e); | ||
}; | ||
@@ -876,4 +878,2 @@ }, e.listen = function() { | ||
t.emit("data", e.data, e); | ||
}, this.socket.onerror = function(e) { | ||
t.emit("error", e); | ||
}, this.socket.onclose = function(e) { | ||
@@ -908,3 +908,3 @@ t.emit("close", e); | ||
var e = osc.SerialPort.prototype = Object.create(osc.SLIPPort.prototype); | ||
e.constructor = osc.SerialPort, e.open = function() { | ||
e.constructor = osc.SerialPort, osc.supportsSerial = !0, e.open = function() { | ||
var t = this, e = { | ||
@@ -911,0 +911,0 @@ bitrate: t.options.bitrate |
@@ -1138,2 +1138,4 @@ /*! osc.js 2.3.0, Copyright 2019 Colin Clark | github.com/colinbdclark/osc.js */ | ||
osc.supportsSerial = false; | ||
// Unsupported, non-API function. | ||
@@ -1390,2 +1392,6 @@ osc.firePacketEvents = function (port, packet, timeTag, packetInfo) { | ||
}; | ||
this.socket.onerror = function (err) { | ||
that.emit("error", err); | ||
}; | ||
}; | ||
@@ -1399,6 +1405,2 @@ | ||
this.socket.onerror = function (err) { | ||
that.emit("error", err); | ||
}; | ||
this.socket.onclose = function (e) { | ||
@@ -1405,0 +1407,0 @@ that.emit("close", e); |
@@ -375,3 +375,3 @@ /*! osc.js 2.3.0, Copyright 2019 Colin Clark | github.com/colinbdclark/osc.js */ | ||
"use strict"; | ||
l.firePacketEvents = function(e, t, r, n) { | ||
l.supportsSerial = !1, l.firePacketEvents = function(e, t, r, n) { | ||
t.address ? e.emit("message", t, r, n) : l.fireBundleEvents(e, t, r, n); | ||
@@ -474,5 +474,7 @@ }, l.fireBundleEvents = function(e, t, r, n) { | ||
l.WebSocketPort.setupSocketForBinary(this.socket); | ||
var e = this; | ||
var t = this; | ||
this.socket.onopen = function() { | ||
e.emit("open", e.socket); | ||
t.emit("open", t.socket); | ||
}, this.socket.onerror = function(e) { | ||
t.emit("error", e); | ||
}; | ||
@@ -483,4 +485,2 @@ }, e.listen = function() { | ||
t.emit("data", e.data, e); | ||
}, this.socket.onerror = function(e) { | ||
t.emit("error", e); | ||
}, this.socket.onclose = function(e) { | ||
@@ -487,0 +487,0 @@ t.emit("close", e); |
{ | ||
"name": "osc", | ||
"main": "src/platforms/osc-node.js", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "A JavaScript Open Sound Control (OSC) library that works in Node.js and the browser.", | ||
@@ -6,0 +6,0 @@ "author": "Colin Clark", |
@@ -55,28 +55,7 @@ osc.js | ||
osc.js is typically installed via [Bower](https://bower.io), [npm](https://npmjs.com), or [yarn](https://github.com/yarnpkg/yarn). The latter two can be used for both client-side projects as well as Node.js applications, while Bower is typically used only for browser applications. | ||
osc.js is typically installed via [npm](https://npmjs.com). [Bower](https://bower.io) support is available, but is deprecated. | ||
### Installing with Bower | ||
If you're developing a browser-based project, Bower is probably the simplest way to manage your dependency on osc.js. First, you'll need to [install Bower](https://bower.io/#install-bower), which requires [Node.js](https://nodejs.org/en/). | ||
### Installing with npm | ||
For a Bower-based project, you'll typically want to make a <code>bower.json</code> configuration file. Something like this: | ||
{ | ||
"name": "<your project name>", | ||
"version": "<your project version>", | ||
"dependencies": { | ||
"osc.js": "2.2.0" | ||
} | ||
} | ||
Don't forget to update the <code>name</code>, <code>version</code>, and [any other bower.json fields](https://github.com/bower/spec/blob/master/json.md) appropriately for your project. | ||
And then, to install all your project's dependencies—including osc.js—just run | ||
bower install | ||
Your dependencies will be located in a directory called <code>bower_components</code> in your project root. | ||
### Installing with npm (or yarn) | ||
npm is a package manager for Node.js and web-based projects. Dependencies are registered in the [npmjs.org registry](https://www.npmjs.com/). | ||
@@ -114,3 +93,3 @@ | ||
``` | ||
target=1.8.4 | ||
target=5.0.1 | ||
disturl=https://atom.io/download/electron | ||
@@ -351,2 +330,12 @@ runtime=electron | ||
##### Using osc.js with WebPack, etc. - help wanted! | ||
Users have reported that osc.js can be used in browser-based applications with WebPack by loading the pre-built <code>osc-browser.js</code> package in their code: | ||
```javascript | ||
require("osc/dist/osc-browser"); | ||
``` | ||
osc.js is not currently tested using WebPack due to limited support resources. Nonetheless, contributions are very much welcomed from the community to help make osc.js more idiomatic when using WebPack or similar technologies, particularly if such changes enable continued support of simpler toolchains (or none) and the use of long-standing browser idioms such as plain old <code>script</code> tags. | ||
### Web Sockets in Node.js | ||
@@ -353,0 +342,0 @@ |
@@ -20,2 +20,4 @@ /* | ||
osc.supportsSerial = false; | ||
// Unsupported, non-API function. | ||
@@ -22,0 +24,0 @@ osc.firePacketEvents = function (port, packet, timeTag, packetInfo) { |
@@ -50,2 +50,3 @@ /* | ||
p.constructor = osc.SerialPort; | ||
osc.supportsSerial = true; | ||
@@ -52,0 +53,0 @@ p.open = function () { |
@@ -12,14 +12,7 @@ /* | ||
var osc = osc || require("../osc.js"); | ||
var osc = osc || require("../osc.js"), | ||
SerialPort = require("serialport"); | ||
try { | ||
var SerialPort = require("serialport"); | ||
} catch (err) { | ||
osc.SerialPort = function () { | ||
throw new Error("The Node.js SerialPort library is not installed. osc.js' serial transport is unavailable."); | ||
}; | ||
osc.supportsSerial = true; | ||
return; | ||
} | ||
osc.SerialPort = function (options) { | ||
@@ -26,0 +19,0 @@ this.on("open", this.listen.bind(this)); |
@@ -49,2 +49,6 @@ /* | ||
}; | ||
this.socket.onerror = function (err) { | ||
that.emit("error", err); | ||
}; | ||
}; | ||
@@ -58,6 +62,2 @@ | ||
this.socket.onerror = function (err) { | ||
that.emit("error", err); | ||
}; | ||
this.socket.onclose = function (e) { | ||
@@ -64,0 +64,0 @@ that.emit("close", e); |
@@ -341,2 +341,11 @@ /* | ||
/**************** | ||
* Serial Tests * | ||
****************/ | ||
QUnit.test("Serial port support has been loaded.", function () { | ||
QUnit.expect(1); | ||
QUnit.ok(osc.supportsSerial); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1005888
72
16443
884