precisionDate.ts 499 B

1234567891011121314151617
  1. import { DomManagement } from './domManagement';
  2. /**
  3. * Class containing a set of static utilities functions for precision date
  4. */
  5. export class PrecisionDate {
  6. /**
  7. * Gets either window.performance.now() if supported or Date.now() else
  8. */
  9. public static get Now(): number {
  10. if (DomManagement.IsWindowObjectExist() && window.performance && window.performance.now) {
  11. return window.performance.now();
  12. }
  13. return Date.now();
  14. }
  15. }