immediate.ts 519 B

12345678910111213141516171819
  1. /**
  2. * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. namespace ImmediateScheduler {
  7. // Adds the function to the start of the "immediate queue"
  8. export async function first<T>(f: () => T): Promise<T> {
  9. return f();
  10. }
  11. // Adds the function to the end of the "immediate queue"
  12. export async function last<T>(f: () => T): Promise<T> {
  13. return f();
  14. }
  15. }
  16. export default ImmediateScheduler