DrSensor / nusa

incremental runtime that bring both simplicity and power into webdev (buildless, cross-language, data-driven)
MIT License
4 stars 0 forks source link

`run()` scope #48

Open DrSensor opened 1 year ago

DrSensor commented 1 year ago
run(() => {
  const pid = seInterval(() => {
    console.log("print every 1s")
  }, 1 * s)
  return () => clearInterval(pid)
}, when?: string)

Those that are wrapped in run() scope will run every time (not just once) current <render-scope> is in view and stop (call returned function) when out of view.