timingTools.ts 516 B

123456789101112131415161718
  1. import { DomManagement } from './domManagement';
  2. /**
  3. * Class used to provide helper for timing
  4. */
  5. export class TimingTools {
  6. /**
  7. * Polyfill for setImmediate
  8. * @param action defines the action to execute after the current execution block
  9. */
  10. public static SetImmediate(action: () => void) {
  11. if (DomManagement.IsWindowObjectExist() && window.setImmediate) {
  12. window.setImmediate(action);
  13. } else {
  14. setTimeout(action, 1);
  15. }
  16. }
  17. }