new SaveLoad(xnullable, ynullable)
Class for saving/loading JSON.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x |
number |
<nullable> |
X coordinate. |
y |
number |
<nullable> |
Y coordinate. |
- Source:
Members
classes :object
Class constructors by name.
Type:
- object
- Source:
Methods
addClass(constructor, nameopt, overwriteopt)
Add a class.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
constructor |
function | Class constructor. | ||
name |
string |
<optional> |
constructor.name | Class name. |
overwrite |
boolean |
<optional> |
false | Overwrite if class exists. |
- Source:
fromJson(data) → {object}
Load from JSON.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | JSON data. |
- Source:
Returns:
- Type
- object
getClass(name) → {function}
Get class by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Class name. |
- Source:
Returns:
Class constructor.
- Type
- function
toJson(obj, nameopt) → {object}
Save to JSON.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
obj |
object | Object to save. | ||
name |
string |
<optional> |
obj.constructor.name | Class name. |
- Source:
Returns:
- Type
- object