aboutsummaryrefslogtreecommitdiffstats
path: root/packages/vold-utils/docs/unload+.md
blob: 78693efa3e9405e6c219d1c3f87d6280f0f3d1f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!-- contributed by Erik Vold [erikvvold@gmail.com]  -->

The `unload+` module allows modules to register callbacks that are called
when they are unloaded, and associate unload functions to containers to have the
unloader automatically deleted when the container unloads.

<api name="unload">
@function
  Save callbacks to run when unloading in a unload queue. Optionally scope the
  callback to a container, e.g., window. Provide a way to run all the callbacks.

@param callback {function}
  A function to be called when the module unloads.
@param [container] {object}
  Optional container object; if the container "unloads" before the module
  unloads, then the associated callback is removed from the unload queue.
@returns {function}
  Returns a function which will allow one to remove the callback from the unload
  queue.
</api>