Docs

API

useOnUpdate method

loopic.useOnUpdate([dynamicId], [middlewareFunction])

  • dynamicId String
  • middlewareFunction Function
    • dynamicId String
    • value String
    • next Function

Description

Method used for adding additional middleware functions to the update pipeline. Middleware functions will be called in the same order as they were added to the pipeline.

Middleware function receives dynamicId, the value and the reference to the next middleware function in the pipeline. Next function must be called if you want to execute all other middlewares left for that dynamic id. If you do not want to execute left middlewares, skip adding next() call.

Example

loopic.useOnUpdate("_t1color", (id, value, next) => {
  const element = loopic.getElement("homeColor");
  element.domNode.style.backgroundColor = value;
  next();
})