Global

Methods

around(fn, b4fn, afn, ctxopt) → {function}

Description:
  • Wraps a function with before and after functions.

Source:
Parameters:
Name Type Attributes Description
fn function

The function to wrap.

b4fn function

The function to execute before the wrapped function.

afn function

The function to execute after the wrapped function.

ctx Object <optional>

The context to use when calling the functions.

Returns:
  • The wrapped function.
Type
function

co(func, concurrencyopt, wtopt) → {function}

Description:
  • 创建一个具有并发控制和等待时间选项的函数

Source:
Parameters:
Name Type Attributes Default Description
func function

要协作执行的函数

concurrency number <optional>
1

允许的最大并发执行数

wt number <optional>
0

每次函数执行后的等待时间(以毫秒为单位)

Returns:
  • 返回一个新的函数,该函数接受原始函数的参数并返回一个promise
Type
function

filter(fn, filter, ctx) → {function}

Description:
  • Define a function that filters the execution of another function based on a condition

Source:
Parameters:
Name Type Description
fn
filter
ctx
Returns:
Type
function

wrapper(fn, b4fn, afn, ctx) → {function}

Description:
  • wrap a function with before and after functions, function b4fn will be executed before the function, the return value of before function will be passed to the function, function afn will be executed after the function fn;

Source:
Parameters:
Name Type Description
fn
b4fn
afn
ctx
Returns:
Type
function

Type Definitions

after(fn, afn, ctxopt)

Source:
Parameters:
Name Type Attributes Description
fn function
afn function

the function you want to execute after, it will get 2 arguments, the first is the return value of fn, the second is the arguments of fn

ctx object <optional>

before(fn, b4fn, ctx)

Source:
Parameters:
Name Type Description
fn function
b4fn function
ctx object

Info on the page you want to request