Skip to content

Commit

Permalink
Context.reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
jazz-soft committed Jul 18, 2021
1 parent e473f66 commit 13a6e21
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion javascript/JZZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -2473,16 +2473,25 @@

Context = function() {
var self = this instanceof Context ? this : self = new Context();
if (this == self) self._resume();
if (this == self) {
self._clear();
self._resume();
}
return self;
};
Context.prototype = new _M();
Context.prototype.constructor = Context;
Context.prototype._receive = function(msg) { this._emit(this._read(msg)); };
Context.prototype._read = function(msg) {
if (!msg.length || msg[0] < 0x80) return msg;
if (msg[0] == 0xff) { this._clear(); return msg; }
return msg;
};
Context.prototype._clear = function() {
var i;
this._cc = [];
for (i = 0; i < 16; i++) this._cc[i] = {};
};
JZZ.Context = Context;
_J.prototype.Context = Context;

Expand Down
2 changes: 1 addition & 1 deletion minified/JZZ.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ describe('JZZ.Widget', function() {
describe('JZZ.Context', function() {
it('reset', function() {
var ctxt = JZZ.Context();
ctxt.reset();
ctxt.noteOn(0, 0, 0).reset();
});
});

Expand Down

0 comments on commit 13a6e21

Please sign in to comment.