_.once(func)
Creates a function that is restricted to invoking func
once. Repeat calls to the function return the value of the first invocation. The func
is invoked with the this
binding and arguments of the created function.
Since
0.1.0
Arguments
func
(Function): The function to restrict.
Returns
(Function): Returns the new restricted function.
Example
var initialize = _.once(createApplication);initialize();initialize();// => `createApplication` is invoked once
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .