同步操作将从 苍石/func-js 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
FuncInstance
This class used to initialize AsyncFuncInstance, register and listen event for async methods, manager caches and more storage info
Object
AsyncManager default options
Object
get AsyncFuncInstance default options
Object
Initialed event's default options
string
The event name called on process start
string
The event name called on process end
string
The event name called on method start
string
The event name called on method end
FuncInstance
Kind: global class
Extends: FuncInstance
Properties
Name | Type | Description |
---|---|---|
asyncManager | AsyncManager |
The asyncManger instance bind to this instance |
FuncInstance
AsyncFuncInstance
FuncInstance
| function
FuncInstance
| function
FuncInstance
| function
FuncInstance
| function
FuncInstance
| function
AsyncFuncInstance
Set the manager instance, it's helpful to using the methods without asyncManager
param
Kind: instance method of AsyncFuncInstance
Returns: AsyncFuncInstance
- This function instance
Param | Type | Description |
---|---|---|
manager | AsyncManager |
The async manager instance |
FuncInstance
| function
Sign the async method with identity, to prevent the earlier results override the latest results in to async methods
Kind: instance method of AsyncFuncInstance
Returns: FuncInstance
| function
- This function instance
Param | Type | Description |
---|---|---|
local | string |
This string is using to mark where the method called, two async methods with the same local will leads only one results |
[options] | Object |
The options for sign method |
[options.identity] | function |
A method to generate identity string while calling, default using utils.genID method |
[options.asyncManager] | AsyncManager |
Specified the async manager instance, default to using the params of setManager called |
FuncInstance
| function
This method can hook target method's start, end callback, and registered to async manager.
While result method called, METHOD_START
, PROCESS_START
and more event could be called in its async manager instance
Kind: instance method of AsyncFuncInstance
Returns: FuncInstance
| function
- This function instance
Param | Type | Description |
---|---|---|
[options] | Object |
The options for process method |
[options.start] | function |
Before the target method called, the start method will be called without any params |
[options.end] | function |
After the target method called, the start method will be called without any params |
[options.context] | function |
The context for above methods |
[asyncManager] | AsyncManager |
Specified the async manager instance, default to using the params of setManager called |
FuncInstance
| function
Using this method to cache async function's return value
Kind: instance method of AsyncFuncInstance
Returns: FuncInstance
| function
- This function instance
See
Param | Type | Description |
---|---|---|
[options] | Object |
The options for cache method |
[options.type] | CacheType |
Specified the cache type to using with cache |
[options.setter] | function |
If cache type set custom, this method will be called to set cache |
[options.getter] | function |
If cache type set custom, this method will be called to get cache |
[options.keyPrefix] | string |
The cache key's prefix |
[options.expire] | number |
Specified the expiration(ms) for the cache, default to be 5min |
[asyncManager] | AsyncManager |
Specified the async manager instance, default to using the params of setManager called |
Pre called this method and cache it's returning results for next calling.
Kind: instance method of AsyncFuncInstance
Param | Type | Description |
---|---|---|
[args] | Array.<*> |
The args as called params for method, and it will be identity for next calling. |
[options] | Object |
The options for pre method |
[options.timeout] | number |
Specified the timeout(ms) for this pre cache. |
[options.once] | boolean |
If set true, this pre cache will be removed once read it. |
[options.context] | * |
The context for target async method called. |
[asyncManager] | AsyncManager |
Specified the async manager instance, default to using the params of setManager called |
FuncInstance
| function
Get the method to catch the pre loaded cache
Kind: instance method of AsyncFuncInstance
Returns: FuncInstance
| function
- This function instance
Param | Type | Description |
---|---|---|
[asyncManager] | AsyncManager |
Specified the async manager instance, default to using the params of setManager called |
FuncInstance
| function
If method execute asynchronously, multi methods with same params will execute many times. This method will prevent above, during the first method not finish, all method with the same params and using the method will not execute, and when the first method finished, the return value will be all waited methods' return value
Kind: instance method of AsyncFuncInstance
Returns: FuncInstance
| function
- This function instance
Param | Type | Description |
---|---|---|
[asyncManager] | AsyncManager |
Specified the async manager instance, default to using the params of setManager called |
This class used to initialize AsyncFuncInstance, register and listen event for async methods, manager caches and more storage info
Kind: global class
Properties
Name | Type | Description |
---|---|---|
options | Object |
Options of AsyncManager |
memoryStorage | Object |
Used to store cache in memories |
eventsMapper | Object |
Used to store events' mapper |
signMapper | Object |
Used to store the sign identity mapper |
string
Object
Object
AsyncFuncInstance
| function
Object
AsyncFuncInstance
| function
Param | Type | Description |
---|---|---|
[options] | Object |
options to initialize manager |
Emit event
Kind: instance method of AsyncManager
Param | Type | Description |
---|---|---|
eventName | string |
The event name to emit |
[options] | Object |
Options for emit method |
[options.identity] | Object |
Something to identity the event, only when event name with the same identity emit, the event callback will be fired |
[options.params] | Object |
Specified the params pass to event, ordering to send with event callback |
string
Register event handler
Kind: instance method of AsyncManager
Returns: string
- The event identity, you can using off method to cancel this event listener
Param | Type | Description |
---|---|---|
eventName | string |
Event name for this handler callback |
callback | function |
While event emitting, this callback will be called |
[options] | Object |
Options for on method |
[options.identity] | Object |
Something to identity the event, only when event name with the same identity emit, the event callback will be fired |
[options.params] | Object |
Specified the params pass to event, ordering to send with event callback |
[options.isOnce] | Boolean |
If set true, the callback will only triggered once, default false |
[options.isAsync] | Boolean |
If set true, the callback will exec async |
Remove the event register
Kind: instance method of AsyncManager
Param | Type | Description |
---|---|---|
eventIdentity |
string | Boolean
|
The return value of on method to cancel listening, if set true, all event will be canceled. |
Object
Get storage cached in memory
Kind: instance method of AsyncManager
Object
Get signed mapper existed
Kind: instance method of AsyncManager
AsyncFuncInstance
| function
Initialize AsyncFuncInstance using options and using this AsyncManager instance
Kind: instance method of AsyncManager
Returns: AsyncFuncInstance
| function
- The AsyncFuncInstance instance
Param | Type | Description |
---|---|---|
func | function |
Specified the target function to be AsyncFuncInstance instance |
[options] | Object |
The options to initialize AsyncFuncInstance |
Object
Get the pre cache of target instance
Kind: instance method of AsyncManager
Param | Type | Description |
---|---|---|
instanceId | string |
The id of target instance |
AsyncFuncInstance
| function
Initialize AsyncFuncInstance using options and new AsyncManager instance
Kind: static method of AsyncManager
Returns: AsyncFuncInstance
| function
- The AsyncFuncInstance instance
Param | Type | Description |
---|---|---|
func | function |
Specified the target function to be AsyncFuncInstance instance |
[options] | Object |
The options to initialize AsyncFuncInstance |
enum
Enum for cache-type values.
Kind: global enum
Read only: true
Properties
Name |
---|
LOCAL_STORAGE |
SESSION_STORAGE |
MEMORY |
CUSTOM |
Object
AsyncManager default options
Kind: global constant
Read only: true
Object
get AsyncFuncInstance default options
Object
Initialed event's default options
Kind: global constant
Read only: true
string
The event name called on process start
string
The event name called on process end
string
The event name called on method start
string
The event name called on method end
Kind: global constant
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。