Skip to content

Call a cycle of functions over time

Notifications You must be signed in to change notification settings

deleteme/looper.js

Repository files navigation

Demo

https://looper-demo.glitch.me

When used with the webkit heap profiler and timeline, this tool is useful for confirming action cleanliness and detecting memory leaks in your web application.

  1. import looper from "https://cdn.jsdelivr.net/npm/[email protected]/dist-web/index.js"
  2. Create a heap profile under webkit tools 'Profile'.
  3. Using the browser's console, create a loop function, providing an array of functions to looper: var loop = looper([setup, teardown])
  4. Record activity in the webkit timeline.
  5. Calling this function returns a Promise of the completion, which defaults to 27 runs. Run the function: loop().
  6. Let Looper finish.
  7. Stop recording in the webkit timeline.
  8. Create a second heap profile.
  9. Compare the two heaps and evaluate memory growth in the timeline.