Queue
Example:
let queue = new Queue();
Constructor Summary
Public Constructor | ||
public |
Class constructor |
Method Summary
Public Methods | ||
public |
Adds classes for browser type to body for use in CSS |
|
public |
capitalizeFirstLetter(string: *): string Helper function to upcase first letter of string |
|
public |
checkQueueable(name: *, obj: *): boolean |
|
public |
cleanMemory(pid: *) Called at the end of a queue run to flush any garbage |
|
public |
Clean up any finished queues |
|
public |
commandParse(command: *): object This will take a command string in the format object.command({},{}); and split it down into it parts as an object |
|
public |
commandsBind(commandObj: *) Bind the events to the dom based on the command Object |
|
public |
commandsQueue(commandObj: *) Take the commands array with command objects in it and add them to the queue if they are marked as instant. |
|
public |
consoleBadge(options: *) |
|
public |
deepCopy(inputObject: *): any Deep copy and object IE remove references |
|
public |
deleteMemory(name: *): boolean Delete Memory TODO clean up perms |
|
public |
deleteRegister(name: *): boolean delete a register |
|
public |
Execute a queue that is loaded into prepare |
|
public |
findQueueByPid(pid: *): * Find a queue item by searching for its PID |
|
public |
finished(pid: *, mode: *) Called to flag a queue item as finished |
|
public |
getCookie(name: *): * Retrieve a cookie by name |
|
public |
getElement(elementTarget: *, errorTrap: *): object | false Finds an element in the dom using the jquery formant IE #id .class tag (will only ever return one) |
|
public |
getElements(elementTarget: *): object | false Finds an element(s) in the dom using the jquery formant IE #id .class tag (can return one or more) |
|
public |
getIframeElements(iframeTarget: *, elementTarget: *, errorTrap: *): object | false Finds elements in the dom of an iframe (or current document) using the query selector |
|
public |
handleFetchErrors(response: *): Object Error Handler for fetch calls |
|
public |
isWork(): * Is there any work to do in the queue? |
|
public |
jsonVars(json: *): any Process a json object and replace {{!}} tags + # tags |
|
public |
Called by queueables to add something to our memory stack |
|
public |
menu() Work in progress, |
|
public |
objectMap(obj: *, mapFunction: *) Map an object with sub objects using a map function |
|
public |
prettyCommandObject(commandObject: *, indent: *) Make a pretty version of the currrent commandObject and dump it to the console |
|
public |
queueProcess(sync: *) Force a queue processing |
|
public |
renderToDom(domObject: *, text: *, mode: *): boolean Render some text/html to the dom |
|
public |
reportError(error: *, message: *) Report an error to the console, adds various internal stats |
|
public |
setCookie(name: *, value: *): * set a cookie by name and value |
|
public |
Set memory that is not associated with a running queueable (IE from the templates) |
|
public |
setRegister(name: *): boolean Set a register |
|
public |
Set a queue stack item |
|
public |
show() Show current queue status in the console DEBUG function |
|
public |
templateLoader(): void Loads templates from the template stack. |
|
public |
templateParse(template: *): string Takes a template and runs any template commands contained in it to create a HTML template ready to be put into the dom |
|
public |
templateProcessor(templateId: *, targetId: *): boolean | string Template processor Takes a template, process it and places into the dom |
|
public |
templateVars(template: *): * Process the template looking for {{}} instances |
|
public |
urlToJson(): * Get any params from the url in json format |
|
public |
varsParser(parseString: *): any parse a var string |
Private Methods | ||
private |
Load perm memory items from cookies |
|
private |
Flush any permanent memory to cookies |
Public Constructors
Public Methods
public capitalizeFirstLetter(string: *): string source
Helper function to upcase first letter of string
Params:
Name | Type | Attribute | Description |
string | * |
public checkQueueable(name: *, obj: *): boolean source
Params:
Name | Type | Attribute | Description |
name | * | ||
obj | * |
public cleanMemory(pid: *) source
Called at the end of a queue run to flush any garbage
Params:
Name | Type | Attribute | Description |
pid | * |
public commandParse(command: *): object source
This will take a command string in the format object.command({},{}); and split it down into it parts as an object
TODO no concept of the context of the command IE was it from inside a div that need binding?
Params:
Name | Type | Attribute | Description |
command | * | {string} |
public commandsBind(commandObj: *) source
Bind the events to the dom based on the command Object
Params:
Name | Type | Attribute | Description |
commandObj | * |
public commandsQueue(commandObj: *) source
Take the commands array with command objects in it and add them to the queue if they are marked as instant. IE ready to execute
Params:
Name | Type | Attribute | Description |
commandObj | * |
public consoleBadge(options: *) source
Params:
Name | Type | Attribute | Description |
options | * |
public deepCopy(inputObject: *): any source
Deep copy and object IE remove references
Params:
Name | Type | Attribute | Description |
inputObject | * |
Return:
any |
public deleteMemory(name: *): boolean source
Delete Memory TODO clean up perms
Params:
Name | Type | Attribute | Description |
name | * |
public deleteRegister(name: *): boolean source
delete a register
Params:
Name | Type | Attribute | Description |
name | * |
public execute(prepareName: *, json: *, silentFail: *): boolean source
Execute a queue that is loaded into prepare
Params:
Name | Type | Attribute | Description |
prepareName | * | {string} Name of the prepared queue |
|
json | * | {object} |
|
silentFail | * | {boolean} |
public findQueueByPid(pid: *): * source
Find a queue item by searching for its PID
Params:
Name | Type | Attribute | Description |
pid | * |
Return:
* |
public finished(pid: *, mode: *) source
Called to flag a queue item as finished
Normally hooked down from queueable this is a queue item saying I have finished in mode (see define.js)
Params:
Name | Type | Attribute | Description |
pid | * | ||
mode | * |
public getCookie(name: *): * source
Retrieve a cookie by name
Params:
Name | Type | Attribute | Description |
name | * | Cookie name |
Return:
* |
public getElement(elementTarget: *, errorTrap: *): object | false source
Finds an element in the dom using the jquery formant IE #id .class tag (will only ever return one)
Params:
Name | Type | Attribute | Description |
elementTarget | * | ||
errorTrap | * | {boolean} Trap any errors? |
public getElements(elementTarget: *): object | false source
Finds an element(s) in the dom using the jquery formant IE #id .class tag (can return one or more)
Params:
Name | Type | Attribute | Description |
elementTarget | * |
public getIframeElements(iframeTarget: *, elementTarget: *, errorTrap: *): object | false source
Finds elements in the dom of an iframe (or current document) using the query selector
Params:
Name | Type | Attribute | Description |
iframeTarget | * | Iframe or false |
|
elementTarget | * | query |
|
errorTrap | * | {boolean} Trap any errors? |
public handleFetchErrors(response: *): Object source
Error Handler for fetch calls
Params:
Name | Type | Attribute | Description |
response | * | {object} - Fetch response object |
public jsonVars(json: *): any source
Process a json object and replace {{!}} tags + # tags
Params:
Name | Type | Attribute | Description |
json | * |
Return:
any |
public memory(name: *, value: *, pid: *): boolean source
Called by queueables to add something to our memory stack
Params:
Name | Type | Attribute | Description |
name | * | ||
value | * | ||
pid | * |
public objectMap(obj: *, mapFunction: *) source
Map an object with sub objects using a map function
Params:
Name | Type | Attribute | Description |
obj | * | ||
mapFunction | * |
public prettyCommandObject(commandObject: *, indent: *) source
Make a pretty version of the currrent commandObject and dump it to the console
Params:
Name | Type | Attribute | Description |
commandObject | * | ||
indent | * |
public queueProcess(sync: *) source
Force a queue processing
This launches the actual objects using a timeout
Params:
Name | Type | Attribute | Description |
sync | * | {boolean} - Send true to force sync mode (Really only for test mode) |
public renderToDom(domObject: *, text: *, mode: *): boolean source
Render some text/html to the dom
Params:
Name | Type | Attribute | Description |
domObject | * | {object} - The object in the dom to write to |
|
text | * | {string} - The text/HTML to write |
|
mode | * | {number} - Mode to use while writing see define.js |
public reportError(error: *, message: *) source
Report an error to the console, adds various internal stats
Params:
Name | Type | Attribute | Description |
error | * | ||
message | * |
public setCookie(name: *, value: *): * source
set a cookie by name and value
Params:
Name | Type | Attribute | Description |
name | * | Cookie name |
|
value | * | Value of cookie |
Return:
* |
public setMemory(name: *, value: *, mode: *): boolean source
Set memory that is not associated with a running queueable (IE from the templates)
Params:
Name | Type | Attribute | Description |
name | * | ||
value | * | ||
mode | * |
public setRegister(name: *): boolean source
Set a register
Params:
Name | Type | Attribute | Description |
name | * |
public setStack(pid: *, name: *, value: *): boolean source
Set a queue stack item
Params:
Name | Type | Attribute | Description |
pid | * | ||
name | * | ||
value | * |
public templateLoader(): void source
Loads templates from the template stack. Recursively calls self until stack is empty
Return:
void |
public templateParse(template: *): string source
Takes a template and runs any template commands contained in it to create a HTML template ready to be put into the dom
Params:
Name | Type | Attribute | Description |
template | * | {string} |
public templateProcessor(templateId: *, targetId: *): boolean | string source
Template processor Takes a template, process it and places into the dom
Params:
Name | Type | Attribute | Description |
templateId | * | {string} - ID of the template |
|
targetId | * | {string|false} - Place in the dom the put the result. In the event of false we process without dom |
public templateVars(template: *): * source
Process the template looking for {{}} instances
Params:
Name | Type | Attribute | Description |
template | * |
Return:
* |
public varsParser(parseString: *): any source
parse a var string
TODO This is massively insecure. If as user can input {{}} into a form and have it displayed to other users they can take over. We either clean all input as you would with <script> etc tags or we manually write a parser.
Params:
Name | Type | Attribute | Description |
parseString | * |
Return:
any |