System – durandal/system
caution
The interface documentation for this module is incomplete. Declarations may be missing or invalid.
Variables
version
noop
noop: () => void
A noop function.
version: string
Durandal's version.
Functions
acquire
acquire(moduleId: string[]): JQuery.Promise
acquire(...moduleId: string[]): JQuery.Promise
Uses require.js to obtain a module. This function returns a promise which resolves with the module instance. You can pass more than one module id to this function or an array of ids. If more than one or an array is passed, then the promise will resolve with an array of module instances.
- (param) moduleId – The id(s) of the modules to load.
- returns – A promise for the loaded module(s).
assert
assert(condition: boolean, message?: string)
Asserts a condition by throwing an error if the condition fails.
- (param) condition – The condition to check.
- (param) message – The message to report in the error if the condition check fails.
debug
debug(enable?: boolean): boolean
Gets/Sets whether or not Durandal is in debug mode.
- (param) enable – Turns on/off debugging.
- returns – Whether or not Durandal is current debugging.
defer
defer(action?): JQuery.Deferred
Creates a deferred object which can be used to create a promise. Optionally pass a function action to perform which will be passed an object used in resolving the promise.
- (param) action – The action to defer. You will be passed the deferred object as a paramter.
- returns – The deferred object.
error
log(obj: string | Error): void
Logs an error.
- (param) obj – The error to report.
extend
extend(obj, ...extension)
Extends the first object with the properties of the following objects.
- (param) obj – The target object to extend.
- returns – Uses to extend the target object.
getModuleId
getModuleId(obj): string
Gets the module id for the specified object.
- (param) obj – The object whose module id you wish to determine.
- returns – The module id.
guid
guid(): string
Creates a simple V4 UUID. This should not be used as a PK in your database. It can be used to generate internal, unique ids. For a more robust solution see node-uuid.
- returns – The guid.
isArray
isArray(obj): obj is unknown[]
Determines if the specified object is an array.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isArguments
isArguments(obj): boolean
Determines if the specified object is a function arguments object.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isBoolean
isBoolean(obj): obj is boolean
Determines if the specified object is a boolean.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isDate
isDate(obj): obj is Date
Determines if the specified object is a date.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isElement
isElement(obj): obj is Element
Determines if the specified object is an html element.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isFunction
isFunction(obj): obj is (...args: any) => unknown
Determines if the specified object is a function.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isNumber
isNumber(obj): obj is number
Determines if the specified object is a number.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isObject
isObject(obj): obj is object
Determines if the specified object is...an object. ie. Not an array, string, etc.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isPromise
isPromise(obj): obj is { then(...args: any): unknown }
Determines if the specified object is a promise.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isRegExp
isRegExp(obj): obj is RegExp
Determines if the specified object is a regex.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
isString
isString(obj): obj is string
Determines if the specified object is a string.
- (param) obj – The object to check.
- returns – True if matches the type, false otherwise.
keys
keys(obj): string[]
Gets all the owned keys of the specified object.
- (param) obj – The object whose owned keys should be returned.
- returns – The keys.
log
log(...info): void
Logs data to the console. Pass any number of parameters to be logged. Log output is not processed if the framework is not running in debug mode.
resolveObject
resolveObject<T>(module: (new () => T) | T): T
Resolves the default object instance for a module. If the module is an object, the module is returned. If the module is a function, that function is called with new and it's result is returned.
- (param) module – The module to use to get/create the default object for.
- returns – The default object for the module.
setModuleId
setModuleId(obj, id: string): void
Sets the module id for the specified object.
- (param) obj – The object whose module id you wish to set.
- (param) id – The id to set for the specified object.
wait
wait(milliseconds?: number): JQuery.Promise
Uses a setTimeout to wait the specified milliseconds.
- (param) milliseconds – The number of milliseconds to wait.