JS API

autoUpdate([interval]), cancelAutoUpdate()

Start or stop periodic re-rendering from JavaScript, the counterpart of the auto:update attribute.

Syntax

  • doodle.autoUpdate([interval])
  • doodle.cancelAutoUpdate()
interval
A number of milliseconds, or a string with ms, s or m. Default 2000, minimum 500.

Calling autoUpdate() again restarts the timer with the new interval. cancelAutoUpdate() stops it and removes the auto:update attribute if present.

Examples

const doodle = document.querySelector('css-doodle');

doodle.autoUpdate('3s');

// later
doodle.cancelAutoUpdate();

See also