mapscreenr
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -9,2 +9,8 @@ declare namespace MapScreenr { | ||
/** | ||
* Known variables, keyed by name. | ||
*/ | ||
interface IVariables { | ||
[i: string]: any; | ||
} | ||
/** | ||
* Settings to initialize a new instance of the MapScreenr class. | ||
@@ -22,3 +28,3 @@ */ | ||
/** | ||
* A mapping of Functions to generate member variables that should be | ||
* A mapping of functions to generate member variables that should be | ||
* recomputed on screen change, keyed by variable name. | ||
@@ -34,5 +40,7 @@ */ | ||
*/ | ||
variables: { | ||
[i: string]: any; | ||
}; | ||
variables?: IVariables; | ||
/** | ||
* A scope to run functions in, if not this IMapScreenr. | ||
*/ | ||
scope?: any; | ||
} | ||
@@ -130,5 +138,3 @@ /** | ||
*/ | ||
variables: { | ||
[i: string]: any; | ||
}; | ||
variables: IVariables; | ||
} | ||
@@ -182,6 +188,8 @@ /** | ||
*/ | ||
variables: { | ||
[i: string]: any; | ||
}; | ||
variables: IVariables; | ||
/** | ||
* A scope to run functions in, if not this MapScreenr. | ||
*/ | ||
private scope; | ||
/** | ||
* Resets the MapScreenr. All members of the settings argument are copied | ||
@@ -188,0 +196,0 @@ * to the MapScreenr itself, though only width and height are required. |
@@ -14,2 +14,6 @@ var MapScreenr; | ||
function MapScreenr(settings) { | ||
/** | ||
* Assorted known variables, keyed by name. | ||
*/ | ||
this.variables = {}; | ||
if (typeof settings === "undefined") { | ||
@@ -31,7 +35,8 @@ throw new Error("No settings object given to MapScreenr."); | ||
} | ||
this.height = settings.height; | ||
this.width = settings.width; | ||
this.scope = settings.scope || this; | ||
this.variableFunctions = settings.variableFunctions || {}; | ||
this.variableArgs = settings.variableArgs || []; | ||
} | ||
/* State changes | ||
*/ | ||
/** | ||
@@ -66,4 +71,4 @@ * Completely clears the MapScreenr for use in a new Area. Positioning is | ||
MapScreenr.prototype.setVariables = function () { | ||
for (var i in this.variables) { | ||
if (this.variables.hasOwnProperty(i)) { | ||
for (var i in this.variableFunctions) { | ||
if (this.variableFunctions.hasOwnProperty(i)) { | ||
this.setVariable(i); | ||
@@ -82,7 +87,5 @@ } | ||
this.variables[name] = arguments.length === 1 | ||
? this.variables[name].apply(this, this.variableArgs) | ||
? this.variableFunctions[name].apply(this.scope, this.variableArgs) | ||
: value; | ||
}; | ||
/* Element shifting | ||
*/ | ||
/** | ||
@@ -89,0 +92,0 @@ * Shifts the MapScreenr horizontally and vertically via shiftX and shiftY. |
@@ -10,2 +10,9 @@ namespace MapScreenr { | ||
/** | ||
* Known variables, keyed by name. | ||
*/ | ||
export interface IVariables { | ||
[i: string]: any; | ||
} | ||
/** | ||
* Settings to initialize a new instance of the MapScreenr class. | ||
@@ -25,3 +32,3 @@ */ | ||
/** | ||
* A mapping of Functions to generate member variables that should be | ||
* A mapping of functions to generate member variables that should be | ||
* recomputed on screen change, keyed by variable name. | ||
@@ -39,5 +46,8 @@ */ | ||
*/ | ||
variables: { | ||
[i: string]: any; | ||
}; | ||
variables?: IVariables; | ||
/** | ||
* A scope to run functions in, if not this IMapScreenr. | ||
*/ | ||
scope?: any; | ||
} | ||
@@ -154,5 +164,3 @@ | ||
*/ | ||
variables: { | ||
[i: string]: any; | ||
}; | ||
variables: IVariables; | ||
} | ||
@@ -217,7 +225,10 @@ | ||
*/ | ||
public variables: { | ||
[i: string]: any; | ||
}; | ||
public variables: IVariables = {}; | ||
/** | ||
* A scope to run functions in, if not this MapScreenr. | ||
*/ | ||
private scope: any; | ||
/** | ||
* Resets the MapScreenr. All members of the settings argument are copied | ||
@@ -240,3 +251,3 @@ * to the MapScreenr itself, though only width and height are required. | ||
if (settings.variables) { | ||
for (let name in settings.variables) { | ||
for (const name in settings.variables) { | ||
if (settings.variables.hasOwnProperty(name)) { | ||
@@ -248,2 +259,5 @@ this.variables[name] = settings.variables[name]; | ||
this.height = settings.height; | ||
this.width = settings.width; | ||
this.scope = settings.scope || this; | ||
this.variableFunctions = settings.variableFunctions || {}; | ||
@@ -253,5 +267,2 @@ this.variableArgs = settings.variableArgs || []; | ||
/* State changes | ||
*/ | ||
/** | ||
@@ -291,4 +302,4 @@ * Completely clears the MapScreenr for use in a new Area. Positioning is | ||
public setVariables(): void { | ||
for (let i in this.variables) { | ||
if (this.variables.hasOwnProperty(i)) { | ||
for (const i in this.variableFunctions) { | ||
if (this.variableFunctions.hasOwnProperty(i)) { | ||
this.setVariable(i); | ||
@@ -308,9 +319,6 @@ } | ||
this.variables[name] = arguments.length === 1 | ||
? this.variables[name].apply(this, this.variableArgs) | ||
? this.variableFunctions[name].apply(this.scope, this.variableArgs) | ||
: value; | ||
} | ||
/* Element shifting | ||
*/ | ||
/** | ||
@@ -317,0 +325,0 @@ * Shifts the MapScreenr horizontally and vertically via shiftX and shiftY. |
{ | ||
"name": "mapscreenr", | ||
"description": "A flexible container for map attributes and viewport.", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Josh Goldberg", |
@@ -9,2 +9,9 @@ /** | ||
/** | ||
* Known variables, keyed by name. | ||
*/ | ||
export interface IVariables { | ||
[i: string]: any; | ||
} | ||
/** | ||
* Settings to initialize a new instance of the MapScreenr class. | ||
@@ -24,3 +31,3 @@ */ | ||
/** | ||
* A mapping of Functions to generate member variables that should be | ||
* A mapping of functions to generate member variables that should be | ||
* recomputed on screen change, keyed by variable name. | ||
@@ -38,5 +45,8 @@ */ | ||
*/ | ||
variables: { | ||
[i: string]: any; | ||
}; | ||
variables?: IVariables; | ||
/** | ||
* A scope to run functions in, if not this IMapScreenr. | ||
*/ | ||
scope?: any; | ||
} | ||
@@ -153,5 +163,3 @@ | ||
*/ | ||
variables: { | ||
[i: string]: any; | ||
}; | ||
variables: IVariables; | ||
} |
@@ -14,2 +14,6 @@ define(["require", "exports"], function (require, exports) { | ||
function MapScreenr(settings) { | ||
/** | ||
* Assorted known variables, keyed by name. | ||
*/ | ||
this.variables = {}; | ||
if (typeof settings === "undefined") { | ||
@@ -31,7 +35,8 @@ throw new Error("No settings object given to MapScreenr."); | ||
} | ||
this.height = settings.height; | ||
this.width = settings.width; | ||
this.scope = settings.scope || this; | ||
this.variableFunctions = settings.variableFunctions || {}; | ||
this.variableArgs = settings.variableArgs || []; | ||
} | ||
/* State changes | ||
*/ | ||
/** | ||
@@ -66,4 +71,4 @@ * Completely clears the MapScreenr for use in a new Area. Positioning is | ||
MapScreenr.prototype.setVariables = function () { | ||
for (var i in this.variables) { | ||
if (this.variables.hasOwnProperty(i)) { | ||
for (var i in this.variableFunctions) { | ||
if (this.variableFunctions.hasOwnProperty(i)) { | ||
this.setVariable(i); | ||
@@ -82,7 +87,5 @@ } | ||
this.variables[name] = arguments.length === 1 | ||
? this.variables[name].apply(this, this.variableArgs) | ||
? this.variableFunctions[name].apply(this.scope, this.variableArgs) | ||
: value; | ||
}; | ||
/* Element shifting | ||
*/ | ||
/** | ||
@@ -89,0 +92,0 @@ * Shifts the MapScreenr horizontally and vertically via shiftX and shiftY. |
@@ -1,2 +0,2 @@ | ||
import { IMapScreenr, IMapScreenrSettings, IVariableFunctions } from "./IMapScreenr"; | ||
import { IMapScreenr, IMapScreenrSettings, IVariables, IVariableFunctions } from "./IMapScreenr"; | ||
@@ -60,7 +60,10 @@ /** | ||
*/ | ||
public variables: { | ||
[i: string]: any; | ||
}; | ||
public variables: IVariables = {}; | ||
/** | ||
* A scope to run functions in, if not this MapScreenr. | ||
*/ | ||
private scope: any; | ||
/** | ||
* Resets the MapScreenr. All members of the settings argument are copied | ||
@@ -83,3 +86,3 @@ * to the MapScreenr itself, though only width and height are required. | ||
if (settings.variables) { | ||
for (let name in settings.variables) { | ||
for (const name in settings.variables) { | ||
if (settings.variables.hasOwnProperty(name)) { | ||
@@ -91,2 +94,5 @@ this.variables[name] = settings.variables[name]; | ||
this.height = settings.height; | ||
this.width = settings.width; | ||
this.scope = settings.scope || this; | ||
this.variableFunctions = settings.variableFunctions || {}; | ||
@@ -96,5 +102,2 @@ this.variableArgs = settings.variableArgs || []; | ||
/* State changes | ||
*/ | ||
/** | ||
@@ -134,4 +137,4 @@ * Completely clears the MapScreenr for use in a new Area. Positioning is | ||
public setVariables(): void { | ||
for (let i in this.variables) { | ||
if (this.variables.hasOwnProperty(i)) { | ||
for (const i in this.variableFunctions) { | ||
if (this.variableFunctions.hasOwnProperty(i)) { | ||
this.setVariable(i); | ||
@@ -151,9 +154,6 @@ } | ||
this.variables[name] = arguments.length === 1 | ||
? this.variables[name].apply(this, this.variableArgs) | ||
? this.variableFunctions[name].apply(this.scope, this.variableArgs) | ||
: value; | ||
} | ||
/* Element shifting | ||
*/ | ||
/** | ||
@@ -160,0 +160,0 @@ * Shifts the MapScreenr horizontally and vertically via shiftX and shiftY. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
50516
1438
0