Skip to content

Commit

Permalink
Build files
Browse files Browse the repository at this point in the history
  • Loading branch information
adzialocha committed Mar 12, 2019
1 parent 998e7c6 commit cf0827f
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 46 deletions.
88 changes: 44 additions & 44 deletions lib/osc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.OSC = factory());
}(this, (function () { 'use strict';
(global = global || self, global.OSC = factory());
}(this, function () { 'use strict';

function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
Expand Down Expand Up @@ -234,24 +234,24 @@
throw new Error('OSC Atomic cant\'t be packed without given method or byteLength');
}
var data = new Uint8Array(byteLength);
var dataView$$1 = new DataView(data.buffer);
var dataView = new DataView(data.buffer);
if (isUndefined(this.value)) {
throw new Error('OSC Atomic cant\'t be encoded with empty value');
}
dataView$$1[method](this.offset, this.value, false);
dataView[method](this.offset, this.value, false);
return data;
}
}, {
key: "unpack",
value: function unpack(dataView$$1, method, byteLength) {
value: function unpack(dataView, method, byteLength) {
var initialOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
if (!(dataView$$1 && method && byteLength)) {
if (!(dataView && method && byteLength)) {
throw new Error('OSC Atomic cant\'t be unpacked without given dataView, method or byteLength');
}
if (!(dataView$$1 instanceof DataView)) {
if (!(dataView instanceof DataView)) {
throw new Error('OSC Atomic expects an instance of type DataView');
}
this.value = dataView$$1[method](initialOffset, false);
this.value = dataView[method](initialOffset, false);
this.offset = initialOffset + byteLength;
return this.offset;
}
Expand All @@ -276,9 +276,9 @@
}
}, {
key: "unpack",
value: function unpack(dataView$$1) {
value: function unpack(dataView) {
var initialOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return _get(_getPrototypeOf(AtomicInt32.prototype), "unpack", this).call(this, dataView$$1, 'getInt32', 4, initialOffset);
return _get(_getPrototypeOf(AtomicInt32.prototype), "unpack", this).call(this, dataView, 'getInt32', 4, initialOffset);
}
}]);
return AtomicInt32;
Expand Down Expand Up @@ -325,24 +325,24 @@
}
}, {
key: "unpack",
value: function unpack(dataView$$1) {
value: function unpack(dataView) {
var initialOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (!(dataView$$1 instanceof DataView)) {
if (!(dataView instanceof DataView)) {
throw new Error('OSC AtomicString expects an instance of type DataView');
}
var offset = initialOffset;
var charcode;
var charCodes = [];
for (; offset < dataView$$1.byteLength; offset += 1) {
charcode = dataView$$1.getUint8(offset);
for (; offset < dataView.byteLength; offset += 1) {
charcode = dataView.getUint8(offset);
if (charcode !== 0) {
charCodes.push(charcode);
} else {
offset += 1;
break;
}
}
if (offset === dataView$$1.length) {
if (offset === dataView.length) {
throw new Error('OSC AtomicString found a malformed OSC string');
}
this.offset = pad(offset);
Expand Down Expand Up @@ -410,20 +410,20 @@
seconds = _this$value.seconds,
fractions = _this$value.fractions;
var data = new Uint8Array(8);
var dataView$$1 = new DataView(data.buffer);
dataView$$1.setInt32(0, seconds, false);
dataView$$1.setInt32(4, fractions, false);
var dataView = new DataView(data.buffer);
dataView.setInt32(0, seconds, false);
dataView.setInt32(4, fractions, false);
return data;
}
}, {
key: "unpack",
value: function unpack(dataView$$1) {
value: function unpack(dataView) {
var initialOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (!(dataView$$1 instanceof DataView)) {
if (!(dataView instanceof DataView)) {
throw new Error('OSC AtomicTimetag expects an instance of type DataView');
}
var seconds = dataView$$1.getUint32(initialOffset, false);
var fractions = dataView$$1.getUint32(initialOffset + 4, false);
var seconds = dataView.getUint32(initialOffset, false);
var fractions = dataView.getUint32(initialOffset + 4, false);
this.value = new Timetag(seconds, fractions);
this.offset = initialOffset + 8;
return this.offset;
Expand All @@ -450,20 +450,20 @@
}
var byteLength = pad(this.value.byteLength);
var data = new Uint8Array(byteLength + 4);
var dataView$$1 = new DataView(data.buffer);
dataView$$1.setInt32(0, this.value.byteLength, false);
var dataView = new DataView(data.buffer);
dataView.setInt32(0, this.value.byteLength, false);
data.set(this.value, 4);
return data;
}
}, {
key: "unpack",
value: function unpack(dataView$$1) {
value: function unpack(dataView) {
var initialOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (!(dataView$$1 instanceof DataView)) {
if (!(dataView instanceof DataView)) {
throw new Error('OSC AtomicBlob expects an instance of type DataView');
}
var byteLength = dataView$$1.getInt32(initialOffset, false);
this.value = new Uint8Array(dataView$$1.buffer, initialOffset + 4, byteLength);
var byteLength = dataView.getInt32(initialOffset, false);
this.value = new Uint8Array(dataView.buffer, initialOffset + 4, byteLength);
this.offset = pad(initialOffset + 4 + byteLength);
return this.offset;
}
Expand All @@ -488,9 +488,9 @@
}
}, {
key: "unpack",
value: function unpack(dataView$$1) {
value: function unpack(dataView) {
var initialOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return _get(_getPrototypeOf(AtomicFloat32.prototype), "unpack", this).call(this, dataView$$1, 'getFloat32', 4, initialOffset);
return _get(_getPrototypeOf(AtomicFloat32.prototype), "unpack", this).call(this, dataView, 'getFloat32', 4, initialOffset);
}
}]);
return AtomicFloat32;
Expand Down Expand Up @@ -557,15 +557,15 @@
}
}, {
key: "unpack",
value: function unpack(dataView$$1) {
value: function unpack(dataView) {
var initialOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (!(dataView$$1 instanceof DataView)) {
if (!(dataView instanceof DataView)) {
throw new Error('OSC Message expects an instance of type DataView.');
}
var address = new AtomicString();
address.unpack(dataView$$1, initialOffset);
address.unpack(dataView, initialOffset);
var types = new AtomicString();
types.unpack(dataView$$1, address.offset);
types.unpack(dataView, address.offset);
if (address.value.length === 0 || address.value[0] !== '/') {
throw new Error('OSC Message found malformed or missing address string');
}
Expand All @@ -589,7 +589,7 @@
} else {
throw new Error('OSC Message found non-standard argument type');
}
offset = next.unpack(dataView$$1, offset);
offset = next.unpack(dataView, offset);
args.push(next.value);
}
this.offset = offset;
Expand Down Expand Up @@ -664,31 +664,31 @@
}
}, {
key: "unpack",
value: function unpack(dataView$$1) {
value: function unpack(dataView) {
var initialOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
if (!(dataView$$1 instanceof DataView)) {
if (!(dataView instanceof DataView)) {
throw new Error('OSC Bundle expects an instance of type DataView');
}
var parentHead = new AtomicString();
parentHead.unpack(dataView$$1, initialOffset);
parentHead.unpack(dataView, initialOffset);
if (parentHead.value !== BUNDLE_TAG) {
throw new Error('OSC Bundle does not contain a valid #bundle head');
}
var timetag = new AtomicTimetag();
var offset = timetag.unpack(dataView$$1, parentHead.offset);
var offset = timetag.unpack(dataView, parentHead.offset);
this.bundleElements = [];
while (offset < dataView$$1.byteLength) {
while (offset < dataView.byteLength) {
var head = new AtomicString();
var size = new AtomicInt32();
offset = size.unpack(dataView$$1, offset);
offset = size.unpack(dataView, offset);
var item = void 0;
head.unpack(dataView$$1, offset);
head.unpack(dataView, offset);
if (head.value === BUNDLE_TAG) {
item = new Bundle();
} else {
item = new Message();
}
offset = item.unpack(dataView$$1, offset);
offset = item.unpack(dataView, offset);
this.bundleElements.push(item);
}
this.offset = offset;
Expand Down Expand Up @@ -1435,4 +1435,4 @@

return OSC;

})));
}));
Loading

0 comments on commit cf0827f

Please sign in to comment.