New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodegame-client

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodegame-client - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

67

EventEmitter.js

@@ -11,3 +11,2 @@ (function (exports, node, NDDB, JSUS) {

//var parser = exports.parser = {};

@@ -22,6 +21,41 @@

};
this._listeners.d('state', node.GameBit.compareState);
//this._listeners.d('state', node.GameBit.compareState);
this._listeners.d('state', EMcompareState);
//console.log(EMcompareState.toString());
};
function EMcompareState(gb1, gb2) {
if (!gb1 && !gb2) return false;
if (!gb1) return 1;
if (!gb2) return -1;
var gs1 = gb1.state;
var gs2 = gb2.state;
// TODO: check: it is correct to return FALSE, if both
// states are undefined?
if ('undefined' === typeof gs1 && 'undefined' === typeof gs2) return false;
if ('undefined' === typeof gs1) return 1;
if ('undefined' === typeof gs2) return -1;
if ('undefined' === typeof gs1.state && 'undefined' === typeof gs2.state) return false;
if ('undefined' === typeof gs1.state) return 1;
if ('undefined' === typeof gs2.state) return -1;
var result = gs1.state - gs2.state;
if (result === 0 && 'undefined' !== typeof gs1.round) {
result = gs1.round - gs2.round;
if (result === 0 && 'undefined' !== typeof gs1.step) {
result = gs1.step - gs2.step;
}
}
return result;
};
EventEmitter.prototype = {

@@ -31,4 +65,2 @@

addListener: function (type, listener) {

@@ -41,3 +73,7 @@

this._listeners.insert(new Listener(l));
var l = new Listener(l);
console.log('I am inserting a new listener');
console.log(l);
this._listeners.insert(l);
},

@@ -68,3 +104,2 @@

this._listeners.forEach(function(l) {

@@ -109,3 +144,3 @@ if (l.event === event) {

removeListener: function(event, listener) {
if ('undefined' === typeof type) return;
if ('undefined' === typeof event) return;

@@ -124,5 +159,17 @@ var listeners = this._listeners.select('event', '=', event);

clearLocalListeners: function() {
this._listeners.select('state', '=', node.state()).clear(true);
console.log('SIZE: ' + this._listeners.size());
console.log('TO DELETE: ' + this._listeners.select('state', '=', node.game.previous()).count());
this._listeners.select('state', '=', node.game.previous()).delete(true);
console.log('COUNT AFTER DELETE: ' + this._listeners.count());
console.log(this._listeners.fetchValues());
},
clearState: function(state) {
if ('undefined' === typeof state) return;
console.log('TO DELETE: ' + this._listeners.select('state', '=', state).count());
this._listeners.select('state', '=', state).delete(true);
return true;
},
// Debug

@@ -169,2 +216,2 @@ printAllListeners: function() {

, 'undefined' !== typeof JSUS ? JSUS : module.parent.exports.JSUS
);
);

@@ -310,3 +310,2 @@ (function (exports, node) {

Game.prototype.step = function(state) {

@@ -328,2 +327,12 @@

if (func) {
console.log('HOW MANY LISTENERS???');
console.log(node.node._listeners.count());
// Local Listeners from previous state are erased
// before proceeding to next one
node.node.clearState(this.gameState);
console.log(node.node._listeners.count());
gameState.is = GameState.iss.LOADING;

@@ -336,2 +345,34 @@ this.gameState = gameState;

return func.call(node.game);
}
}
return false;
};
Game.prototype.step_old = function(state) {
var gameState = state || this.next();
if (gameState) {
var func = this.gameLoop.getFunction(gameState);
// Experimental: node.window should load the func as well
// if (node.window) {
// var frame = this.gameLoop.getAllParams(gameState).frame;
// node.window.loadFrame(frame);
// }
if (func) {
gameState.is = GameState.iss.LOADING;
this.gameState = gameState;
// This could speed up the loading in other client,
// but now causes problems of multiple update
this.publishState();
// Local Listeners from previous state are erased before proceeding

@@ -338,0 +379,0 @@ // to next one

2

package.json
{
"name": "nodegame-client"
, "description": "nodeGame client for the browser and node.js"
, "version": "0.1.9"
, "version": "0.1.10"
, "main" : "nodeGame.js"

@@ -6,0 +6,0 @@ , "homepage": "http://www.nodegame.org"

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