Рейтинг@Mail.ru

1.1.4. Function box.once

1.1.4. Function box.once

box.once(key, function[, ...])

Execute a function, provided it has not been executed before. A passed value is checked to see whether the function has already been executed. If it has been executed before, nothing happens. If it has not been executed before, the function is invoked. For an explanation why box.once is useful, see the section Preventing Duplicate Actions.

Parameters:
  • key (string) – a value that will be checked
  • function (function) – a function
  • ... – arguments, that must be passed to function