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.
func
this
The function to restrict.
Returns the new restricted function.
5.15.0
const initialize = once(createApplication)initialize()initialize()// => `createApplication` is invoked once Copy
const initialize = once(createApplication)initialize()initialize()// => `createApplication` is invoked once
Creates a function that is restricted to invoking
func
once. Repeat calls to the function return the value of the first invocation. Thefunc
is invoked with thethis
binding and arguments of the created function.