JSFiddle - React, Tailwind, and code Playground
by John Grivas
JavaScript
/*function a() {
a.list.push(this);
}
a.list = [];
new a();
function Spark(ctx) {
console.log("created", this);
Spark.list.push[this];
}
Spark.list = [];
Spark.max = 100;
Spark.createSparks = function (ctx) {
if (this.list.length < this.max) {
new Spark(ctx);
}
};
Spark.createSparks();
*/
var Spark = function (testid) {
/// <summary>
/// Spark class
/// </summary>
var list = [];
var max = 100;
return {
createSparks: function (ctx) {
if (list.length < max) {
this.PushSpark(ctx);
}
},
PushSpark: function (ctx) {
list.push(ctx);
},
getList: function () {
return list;
}
};
};
var a = new Spark();
a.createSparks("thing to push");
a.createSparks("second thing to push");
alert(a.getList());
console.log(a.getList());