ArchAsyncPolling()

new ArchAsyncPolling()

This class provides support for an asynchronous polling mechanism that will resolve a polling promise when a callback function completes successfully. The normal use case is for the polling callback function to return a promise that when it resolves will resolve the polling promise.

Extends

Members

static, readonly displayTypeName :string

Returns the display type name string 'ArchAsyncPolling'.

readonly amPolling :boolean

Returns whether or not this polling class instance is actively polling.

readonly isArchAsyncPolling :boolean

Returns true indicating that this is an ArchAsyncPolling instance.

readonly logStr :string

A logging string for this ArchAsyncPolling instance.

Overrides:

readonly logStrTypeOnly :string

This is a string suitable for logging information about this object where it's just the object's type. This is normally used when logging errors that occur in constructor parameter checking because the scripting object isn't set up and the normal logging str contents wouldn't be set up.

Inherited From:

Methods

beginAsyncPolling(maxTries, intervalMs, callbackFunction, callbackFunctionParmopt) → {Promise}

Call this method to begin asynchronous polling. It will return a promise that will either resolve or be rejected based on the callback function's return value. The total time allowed for an operation is 80 seconds so when you multiply the maxTries * intervalMs parameters, the value cannot exceed 80000 ms. Each instance of this class can only have one polling operation going on at a time. Attempting to call this function with a polling promise that's already been started will result in a failure.

Parameters:
Name Type Attributes Description
maxTries number

the maximum number of times to call the callback function before failing the promise returned by this function. This value should be an integer. The supported value range is >=1 and <=100.

intervalMs number

the number of milliseconds to wait in between invoking the callback function. This value should be an integer. The supported value range is >= 0 and <=15000.

callbackFunction function

the function that should be called back that does work. If this function returns a promise, the callback will wait for the promise to resolve. If the promise is rejected or throws, then a subsequent polling attempt will be made assuming that the polling count maximum in the maxTries parameter has not been exceeded. If the promise returned by the callback function resolved, then the promise returned by this function will resolve. If the the callback function does not return a promise, the promise returned by this method will resolve. Lastly, if the invocation of the callback function throws, this is treated as an error and the promise returned by this function will be rejected. Make sure that if you want the callback function to be bound to an object that when calling it you do it with callbackFunction.bind(this) or whatever but the idea is the caller needs to specify the correct binding.

callbackFunctionParm object <optional>

a parameter to pass to the callback function.

Returns:
Promise

isFilterMatch(archFilterObject) → {boolean}

Returns whether or not this Architect Scripting object is a match for the supplied ArchFilterObject instance.

Parameters:
Name Type Description
archFilterObject ArchFilterObject

the object filter to use to determine if it's a match.

Returns:
boolean
Inherited From:

logError(errorStr)

Logs an error to the logging service with a log header from this object's logStr property value when ArchLogging#logErrors is true.

Parameters:
Name Type Description
errorStr string

the error string to log.

Inherited From:

logErrorAndThrow(errorStr)

Logs an error to the logging service with a log header from this object's logStr property value when ArchLogging#logErrors is true and then throws the string in the errorStr parameter.

Parameters:
Name Type Description
errorStr string

the error string to log. This should be a non-blank string.

Throws:
  • Throws the submitted error string.
Inherited From:

logNote(noteStr)

Logs a note to the logging service with a log header from this object's logStr property value when ArchLogging#logNotes is true.

Parameters:
Name Type Description
noteStr string

the note string to log. This should be a non-blank string.

Inherited From:

logNoteVerbose(noteStr)

Logs a note to the logging service with a log header from this object's logStr property value when ArchLogging#logNotesVerbose is true.

Parameters:
Name Type Description
noteStr string

the note string to log. This should be a non-blank string.

Inherited From:

logWarning(warningStr)

Logs a warning to the logging service with a log header from this object's logStr property value when ArchLogging#logWarnings is true.

Parameters:
Name Type Description
warningStr string

the warning string to log. This should be a non-blank string.

Inherited From: