new PersistantData(url)
- Description:
Implements the interface with a persistent data mechanism.
-
This is the client side of a simple client/server mechanism.
-
The interface is used in HTML page, using a construct of the form:
<script type='text/javascript' src='.../aideweb.js'></script> <script type='text/javascript'> var persistantData = New PersistantData("http://localhost:8080/_persistantData/upload"); // Using, e.g., getNewID persistantData.getNewID(true, true, "", function(value) { console.log("Testing getNewID: " + value); });
-
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The service URL. |
Methods
loadJSON(filename, default_value, callback)
- Description:
Loads a structured value from a given filename.
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | The data file base name without extension. |
default_value |
object | The default value stored into the file if it does not yet exists. |
callback |
callback | The callback that handles the loaded value.
|
saveJSON(filename, value, backupopt, callback)
- Description:
Saves a structured value in a given filename.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filename |
string | The data file base name without extension. |
||
value |
object | The value to save as a JSON data structure. |
||
backup |
boolean |
<optional> |
true
|
If true, backup the file, with date. |
callback |
callback | The callback that handles the next action after saving.
|
list(The, callback)
- Description:
Lists all data file names, and runs the callback function for each file name.
Parameters:
Name | Type | Description |
---|---|---|
The |
string | file format. |
callback |
callback | The callback that handles each data file name.
|
getNewID(whenopt, whereopt, suffixopt, callback)
- Description:
Returns a new ID built from the date in standard format and optionnally the local machine MAC address.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
when |
boolean |
<optional> |
true
|
If true, appends the local machine MAC address. |
where |
boolean |
<optional> |
true
|
If true, appends the local machine MAC address. |
suffix |
string |
<optional> |
""
|
If not empty, appends the suffix to the proposed ID. |
callback |
callback | The callback that handles the new ID value.
|