How to ignore the use of the browser window object?

How can I distract the use of the browser window object when using the Aurelia frame? I would like to avoid direct browser dependency when using functions like setInterval or addEventListener , for example.

Aurelia has something called Platform Abstraction Library, which theoretically should provide the functionality I'm looking for. However, I could not find documentation about this while writing this question.

+6
source share
1 answer

A few examples:

 import {DOM, PLATFORM, FEATURE} from 'aurelia-pal'; PLATFORM.addEventListener('click', e => ...); PLATFORM.requestAnimationFrame(() => ...); let event = DOM.createCustomEvent('foo', { bubbles: true }); DOM.dispatchEvent(event); let element = DOM.createElement('div'); if (FEATURE.shadowDOM && FEATURE.scopedCSS && FEATURE.htmlTemplateElement) { ... } 

There is no setTimeout / setInterval in PAL- I think because aurelia does not use setTimeout . I added issue to add them.

+10
source

All Articles