Skip to content

Commit

Permalink
Release v2.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tswaters committed Nov 18, 2018
1 parent 853549c commit ebaf441
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 42 deletions.
9 changes: 7 additions & 2 deletions CHANGES.MD
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@

## 2.3.1

Fix busted build with evergreen browsers (oops!).

## 2.3.0

Update build to use rollup, there are now 3 supported bunldes:

- fireworks.js - cjs module
- fireworks.node.js - cjs module
- fireworks.mjs - es6 module
- fireworks.umd.js - browser umd bundle
- fireworks.js - browser umd bundle
- fireworks.min.js - browser umd bundle (minified)

The browser bundle now has a target of `es3` so it should support older browsers.

Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as Fireworks from 'fireworks-canvas' // mjs

const Fireworks = require('fireworks-canvas') // cjs

define(['fireworks'], (Fireworks) => {}) // amd
requirejs(['Fireworks'], (Fireworks) => {}) // amd

const Fireworks = window.Fireworks // browser global

Expand Down
53 changes: 26 additions & 27 deletions fireworks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */

var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};

function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
Expand Down Expand Up @@ -141,18 +127,31 @@
return Particle;
}());

var Things = (function (_super) {
__extends(Things, _super);
var Things = (function () {
function Things(_a) {
var maxRockets = _a.maxRockets, numParticles = _a.numParticles, cw = _a.cw, ch = _a.ch;
var _this = _super.call(this) || this;
_this.rockets = 0;
_this.maxRockets = maxRockets;
_this.numParticles = numParticles;
_this.cw = cw;
_this.ch = ch;
return _this;
this._set = new Set();
this.rockets = 0;
this.maxRockets = maxRockets;
this.numParticles = numParticles;
this.cw = cw;
this.ch = ch;
}
Things.prototype.size = function () {
return this._set.size;
};
Things.prototype.entries = function () {
return this._set;
};
Things.prototype.clear = function () {
this._set.clear();
};
Things.prototype["delete"] = function (thing) {
this._set["delete"](thing);
};
Things.prototype.add = function (thing) {
this._set.add(thing);
};
Things.prototype.explode = function (particle) {
this.rockets--;
for (var i = 0; i < this.numParticles; i += 1) {
Expand All @@ -176,7 +175,7 @@
}
};
return Things;
}(Set));
}());

var Fireworks = (function () {
function Fireworks(container, _a) {
Expand Down Expand Up @@ -208,7 +207,7 @@
Fireworks.prototype.start = function () {
var _this = this;
if (this.maxRockets > 0) {
this.interval = setInterval(function () { return _this.things.spawnRockets(); }, this.rocketSpawnInterval);
this.interval = window.setInterval(function () { return _this.things.spawnRockets(); }, this.rocketSpawnInterval);
this.rafInterval = window.requestAnimationFrame(function () { return _this.update(); });
}
return function () { return _this.stop(); };
Expand Down Expand Up @@ -243,7 +242,7 @@
var e_1, _a;
this._clear();
try {
for (var _b = __values(this.things), _c = _b.next(); !_c.done; _c = _b.next()) {
for (var _b = __values(this.things.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
var particle = _c.value;
particle.draw(this.ctx);
particle.update();
Expand All @@ -262,7 +261,7 @@
}
finally { if (e_1) throw e_1.error; }
}
if (this.interval || this.things.size > 0) {
if (this.interval || this.things.size() > 0) {
this.rafInterval = window.requestAnimationFrame(function () { return _this.update(); });
}
else {
Expand Down
2 changes: 1 addition & 1 deletion fireworks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 20 additions & 5 deletions fireworks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,30 @@ class Particle {
}
}

class Things extends Set {
class Things {
constructor({ maxRockets, numParticles, cw, ch }) {
super();
this._set = new Set();
this.rockets = 0;
this.maxRockets = maxRockets;
this.numParticles = numParticles;
this.cw = cw;
this.ch = ch;
}
size() {
return this._set.size;
}
entries() {
return this._set;
}
clear() {
this._set.clear();
}
delete(thing) {
this._set.delete(thing);
}
add(thing) {
this._set.add(thing);
}
explode(particle) {
this.rockets--;
for (let i = 0; i < this.numParticles; i += 1) {
Expand Down Expand Up @@ -154,7 +169,7 @@ class Fireworks {
}
start() {
if (this.maxRockets > 0) {
this.interval = setInterval(() => this.things.spawnRockets(), this.rocketSpawnInterval);
this.interval = window.setInterval(() => this.things.spawnRockets(), this.rocketSpawnInterval);
this.rafInterval = window.requestAnimationFrame(() => this.update());
}
return () => this.stop();
Expand Down Expand Up @@ -184,7 +199,7 @@ class Fireworks {
}
update() {
this._clear();
for (const particle of this.things) {
for (const particle of this.things.entries()) {
particle.draw(this.ctx);
particle.update();
if (particle.shouldRemove(this.cw, this.ch)) {
Expand All @@ -194,7 +209,7 @@ class Fireworks {
this.things.explode(particle);
}
}
if (this.interval || this.things.size > 0) {
if (this.interval || this.things.size() > 0) {
this.rafInterval = window.requestAnimationFrame(() => this.update());
}
else {
Expand Down
25 changes: 20 additions & 5 deletions fireworks.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,30 @@ class Particle {
}
}

class Things extends Set {
class Things {
constructor({ maxRockets, numParticles, cw, ch }) {
super();
this._set = new Set();
this.rockets = 0;
this.maxRockets = maxRockets;
this.numParticles = numParticles;
this.cw = cw;
this.ch = ch;
}
size() {
return this._set.size;
}
entries() {
return this._set;
}
clear() {
this._set.clear();
}
delete(thing) {
this._set.delete(thing);
}
add(thing) {
this._set.add(thing);
}
explode(particle) {
this.rockets--;
for (let i = 0; i < this.numParticles; i += 1) {
Expand Down Expand Up @@ -156,7 +171,7 @@ class Fireworks {
}
start() {
if (this.maxRockets > 0) {
this.interval = setInterval(() => this.things.spawnRockets(), this.rocketSpawnInterval);
this.interval = window.setInterval(() => this.things.spawnRockets(), this.rocketSpawnInterval);
this.rafInterval = window.requestAnimationFrame(() => this.update());
}
return () => this.stop();
Expand Down Expand Up @@ -186,7 +201,7 @@ class Fireworks {
}
update() {
this._clear();
for (const particle of this.things) {
for (const particle of this.things.entries()) {
particle.draw(this.ctx);
particle.update();
if (particle.shouldRemove(this.cw, this.ch)) {
Expand All @@ -196,7 +211,7 @@ class Fireworks {
this.things.explode(particle);
}
}
if (this.interval || this.things.size > 0) {
if (this.interval || this.things.size() > 0) {
this.rafInterval = window.requestAnimationFrame(() => this.update());
}
else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fireworks-canvas",
"version": "2.3.0",
"version": "2.3.1",
"description": "fireworks example",
"browser": "./fireworks.min.js",
"main": "./fireworks.node.js",
Expand Down

0 comments on commit ebaf441

Please sign in to comment.