Implements a list of functions.
Implements: IFunctionCollection
Description
The FunctionCollection class allows you to implement a list of functions
Properties
length
Gets the number of functions stored in the collection.
publiclength(): number
- retuns: number - number of stored functions.
Instance methods
add
Adds a new function to the collection.
publicadd(func: IFunction): void
- func: IFunction - array with function parameters.
clear
Clears the collection.
publicclear(): void
findByName
Finds a function in the list by it’s name.
publicfindByName(name: string): IFunction
- name: string - function name to be found.
- returns: IFunction - function or null if no function was not found.
findIndexByName
Finds a function’s index in the list by it’s name.
publicfindIndexByName(name: string): number
- name: string - function name to be found.
- returns: number - function’s index in the list or -1 if nofunction was not found.
get
Gets a function by its index.
publicget(index: number): IFunction
- index: number - function’s index.
- returns: IFunction - retrieved function.
getAll
Gets all functions stored in the collection.
publicgetAll(): IFunction[]
- returns: IFunction[] - list with functions.
remove
Removes a function by its index.
publicremove(index: number): void
- index: number - index of the function to be removed.
removeByName
Removes a function by its name.
publicremoveByName(name: string): void
- name: string - name of the function to be removed.