shipshapecode/tether

View on GitHub
src/js/utils/deferred.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
const deferred = [];

export function defer(fn) {
  deferred.push(fn);
}

export function flush() {
  let fn;
  // eslint-disable-next-line
  while (fn = deferred.pop()) {
    fn();
  }
}