Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sam-ecs

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sam-ecs - npm Package Compare versions

Comparing version 3.1.1 to 3.2.0

215

dist/Manager.js

@@ -113,2 +113,5 @@ 'use strict';

this._user = undefined;
this._stateCounter = 0;
this._stateQueue = [];
}

@@ -495,34 +498,104 @@

key: 'dispatch',
value: function dispatch(action) {
value: function dispatch(action, unrolling) {
if (action.type === undefined) {
throw "Action must have an action type!";
}
if (!unrolling) {
action.stateCounter = ++this._stateCounter;
}
if (this._dispatchFun) this._dispatchFun(action);
/* don't throw an error because somethings might spew out actions
* that don't necessarily mean an console.error
*/
if (!this._reducers[action.type]) return;
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
if (this._reducers[action.type]) {
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
try {
for (var _iterator4 = this._reducers[action.type][Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var fun = _step4.value;
fun(action, this);
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
}
if (this._dispatchFun) this._dispatchFun(action, unrolling);
if (!unrolling) this._stateQueue.push({
'number': this._stateCounter,
// 'state': currentState,
'action': action
});
}
/**
* @description - Rolls the state of the manager back. Throws away any state
* staler than the 'number'
* @param {Number} number - number indicating how stale the state is
* @param {Object} state - the state object to rollback to
*/
}, {
key: 'rollback',
value: function rollback(number, state) {
if (number > this._stateCounter) {
this._stateCounter = number;
}
var currentNumber = Number.MIN_SAFE_VALUE;
var index = 0;
while (currentNumber < number && index < this._stateQueue.length) {
currentNumber = this._stateQueue[index++].number;
}
this._stateQueue.splice(0, index + 1);
this.clear();
this.fromJSON(state);
}
/**
* @description - Takes the entire state queue and re applies all of the states
* This typically would happen after a rollback
*/
}, {
key: 'unroll',
value: function unroll() {
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
try {
for (var _iterator4 = this._reducers[action.type][Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var fun = _step4.value;
for (var _iterator5 = this._stateQueue[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var action = _step5.value;
fun(action, this);
this.dispatch(action.action, true);
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return) {
_iterator4.return();
if (!_iteratorNormalCompletion5 && _iterator5.return) {
_iterator5.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
if (_didIteratorError5) {
throw _iteratorError5;
}

@@ -598,9 +671,9 @@ }

});
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
var _iteratorNormalCompletion6 = true;
var _didIteratorError6 = false;
var _iteratorError6 = undefined;
try {
for (var _iterator5 = processorNameList[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var processorName = _step5.value;
for (var _iterator6 = processorNameList[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
var processorName = _step6.value;

@@ -617,12 +690,12 @@ var processor = this._processors[processorName];

} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
_didIteratorError6 = true;
_iteratorError6 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5.return) {
_iterator5.return();
if (!_iteratorNormalCompletion6 && _iterator6.return) {
_iterator6.return();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
if (_didIteratorError6) {
throw _iteratorError6;
}

@@ -717,9 +790,9 @@ }

var set = cachedListObject.isSorted ? new SortedSet(Object.keys(this._entitiesByHash), cachedListObject.equal, cachedListObject.compare) : new FastSet(Object.keys(this._entitiesByHash));
var _iteratorNormalCompletion6 = true;
var _didIteratorError6 = false;
var _iteratorError6 = undefined;
var _iteratorNormalCompletion7 = true;
var _didIteratorError7 = false;
var _iteratorError7 = undefined;
try {
for (var _iterator6 = family.getHaves().toArray()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
var component = _step6.value;
for (var _iterator7 = family.getHaves().toArray()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
var component = _step7.value;

@@ -736,12 +809,12 @@ /* none of the entities in the manager have a required component of the

} catch (err) {
_didIteratorError6 = true;
_iteratorError6 = err;
_didIteratorError7 = true;
_iteratorError7 = err;
} finally {
try {
if (!_iteratorNormalCompletion6 && _iterator6.return) {
_iterator6.return();
if (!_iteratorNormalCompletion7 && _iterator7.return) {
_iterator7.return();
}
} finally {
if (_didIteratorError6) {
throw _iteratorError6;
if (_didIteratorError7) {
throw _iteratorError7;
}

@@ -751,9 +824,9 @@ }

var _iteratorNormalCompletion7 = true;
var _didIteratorError7 = false;
var _iteratorError7 = undefined;
var _iteratorNormalCompletion8 = true;
var _didIteratorError8 = false;
var _iteratorError8 = undefined;
try {
for (var _iterator7 = family.getCannotHaves().toArray()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
var component = _step7.value;
for (var _iterator8 = family.getCannotHaves().toArray()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
var component = _step8.value;

@@ -764,12 +837,12 @@ set = set.difference(this.getEntitiesByComponent(component));

} catch (err) {
_didIteratorError7 = true;
_iteratorError7 = err;
_didIteratorError8 = true;
_iteratorError8 = err;
} finally {
try {
if (!_iteratorNormalCompletion7 && _iterator7.return) {
_iterator7.return();
if (!_iteratorNormalCompletion8 && _iterator8.return) {
_iterator8.return();
}
} finally {
if (_didIteratorError7) {
throw _iteratorError7;
if (_didIteratorError8) {
throw _iteratorError8;
}

@@ -855,9 +928,9 @@ }

value: function fromJSON(obj) {
var _iteratorNormalCompletion8 = true;
var _didIteratorError8 = false;
var _iteratorError8 = undefined;
var _iteratorNormalCompletion9 = true;
var _didIteratorError9 = false;
var _iteratorError9 = undefined;
try {
for (var _iterator8 = obj.entities[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
var entityObj = _step8.value;
for (var _iterator9 = obj.entities[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
var entityObj = _step9.value;

@@ -878,12 +951,12 @@ var hashValue = entityObj.hash;

} catch (err) {
_didIteratorError8 = true;
_iteratorError8 = err;
_didIteratorError9 = true;
_iteratorError9 = err;
} finally {
try {
if (!_iteratorNormalCompletion8 && _iterator8.return) {
_iterator8.return();
if (!_iteratorNormalCompletion9 && _iterator9.return) {
_iterator9.return();
}
} finally {
if (_didIteratorError8) {
throw _iteratorError8;
if (_didIteratorError9) {
throw _iteratorError9;
}

@@ -943,9 +1016,9 @@ }

entity._setHash(hash);
var _iteratorNormalCompletion9 = true;
var _didIteratorError9 = false;
var _iteratorError9 = undefined;
var _iteratorNormalCompletion10 = true;
var _didIteratorError10 = false;
var _iteratorError10 = undefined;
try {
for (var _iterator9 = componentList[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
var componentObject = _step9.value;
for (var _iterator10 = componentList[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
var componentObject = _step10.value;

@@ -963,12 +1036,12 @@ if (componentObject.name in this._componentLibrary) {

} catch (err) {
_didIteratorError9 = true;
_iteratorError9 = err;
_didIteratorError10 = true;
_iteratorError10 = err;
} finally {
try {
if (!_iteratorNormalCompletion9 && _iterator9.return) {
_iterator9.return();
if (!_iteratorNormalCompletion10 && _iterator10.return) {
_iterator10.return();
}
} finally {
if (_didIteratorError9) {
throw _iteratorError9;
if (_didIteratorError10) {
throw _iteratorError10;
}

@@ -975,0 +1048,0 @@ }

{
"name": "sam-ecs",
"version": "3.1.1",
"version": "3.2.0",
"description": "A specialized entity component system",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc