/
setup.es6
39 lines (32 loc) · 1.11 KB
/
setup.es6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
((ons) => {
// fastclick
window.addEventListener('load', () => FastClick.attach(document.body), false);
// ons._defaultDeviceBackButtonHandler
window.addEventListener('DOMContentLoaded', () => {
ons._defaultDeviceBackButtonHandler = ons._deviceBackButtonDispatcher.createHandler(window.document.body, () => {
navigator.app.exitApp();
});
}, false);
// setup loading placeholder
ons.ready(function() {
ons._setupLoadingPlaceHolders();
});
// viewport.js
new Viewport().setup();
// modernize
Modernizr.testStyles('#modernizr { -webkit-overflow-scrolling:touch }', function(elem, rule) {
Modernizr.addTest(
'overflowtouch',
window.getComputedStyle && window.getComputedStyle(elem).getPropertyValue('-webkit-overflow-scrolling') == 'touch');
});
// BaseElement
if (typeof HTMLElement !== 'function') {
ons._BaseElement = () => {};
ons._BaseElement.prototype = document.createElement('div');
} else {
ons._BaseElement = HTMLElement;
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = ons;
}
})(window.ons = window.ons || {});