MeadCo
Static class for namespace creation and core utility functions for ScriptX.Services client libraries.
- Description:
Static class for namespace creation and core utility functions for ScriptX.Services client libraries.
This must be included before any other files from this package.
The implementation is for use in a browser only, not general runtime javascript environments.
This code is necessarily 'old-fashioned' as it may find itself running in old versions of IE.
- Source:
Members
(static) logEnabled
Get/set state of logging to console of informational messages.
- Description:
Get/set state of logging to console of informational messages. Default is off
- Source:
Properties:
Name | Type | Description |
---|---|---|
logEnabled |
boolean |
Get/set state of logging to console of informational messages. Default is off
(static) version
Get the version of this module as a string major.minor.hotfix.build
.- Description:
Get the version of this module as a string major.minor.hotfix.build
- Source:
Properties:
Name | Type | Description |
---|---|---|
version |
string |
Get the version of this module as a string major.minor.hotfix.build
Methods
(static) createNS(namespace) → {object}
Create a namespace
.- Description:
Create a namespace
- Source:
Example
var ui = MeadCo.createNS("MeadCo.ScriptX.Print.UI");
ui.Show = function() { alert("hello"); }
Parameters:
Name | Type | Description |
---|---|---|
namespace |
string | path of the namespace |
Returns:
static object for the namespace
- Type
- object
(static) error(text)
Marks the content as an error and sends to the console
.- Description:
Marks the content as an error and sends to the console
- Source:
Parameters:
Name | Type | Description |
---|---|---|
text |
string | to send to console |
(static) log(text)
Sends the content to the console (if informational logging is enabled)
.- Description:
Sends the content to the console (if informational logging is enabled)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
text |
string | to send to console |
(static) makeApiEndPoint(serverUrl, apiLocation) → {string}
Get the url to a ScriptX.Services api.
- Description:
Get the url to a ScriptX.Services api. If an api is already present, it is replaced.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
serverUrl |
string | url to the server |
apiLocation |
string | the api, e.g. v1/printhtml |
Returns:
url to the api
- Type
- string
(static) makeServiceEndPoint(serverUrl, endPoint) → {string}
Get the url to a ScriptX.Services service endpoint.
- Description:
Get the url to a ScriptX.Services service endpoint.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
serverUrl |
string | url to the server |
endPoint |
string | the service endpoint, e.g. v1/preview |
Returns:
url to the endpoint
- Type
- string
(static) parseAjaxError(logText, jqXhr, textStatus, errorThrown) → {string}
Extract the error text from jQuery AJAX response
.- Description:
Extract the error text from jQuery AJAX response
- Source:
Parameters:
Name | Type | Description |
---|---|---|
logText |
string | The lead-in text for a console.log entry |
jqXhr |
object | jQuery ajax header |
textStatus |
string | textStatus result determined by jQuery |
errorThrown |
string | The server exception dewtermined by jQuery |
Returns:
The error text to display
- Type
- string
(static) parseFetchError(errorThrown) → {string}
Extract the error text from browser fetch response
.- Description:
Extract the error text from browser fetch response
- Source:
Parameters:
Name | Type | Description |
---|---|---|
errorThrown |
object | error caught from fetch |
Returns:
The error text to display
- Type
- string
(static) warn(text)
Marks the content as a warning and sends to the console
.- Description:
Marks the content as a warning and sends to the console
- Source:
Parameters:
Name | Type | Description |
---|---|---|
text |
string | to send to console |