1 | export var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
2 |
|
3 | export var addEventListener = function addEventListener(node, event, listener) {
|
4 | return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener);
|
5 | };
|
6 |
|
7 | export var removeEventListener = function removeEventListener(node, event, listener) {
|
8 | return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener);
|
9 | };
|
10 |
|
11 | export var getConfirmation = function getConfirmation(message, callback) {
|
12 | return callback(window.confirm(message));
|
13 | };
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | export var supportsHistory = function supportsHistory() {
|
23 | var ua = window.navigator.userAgent;
|
24 |
|
25 | if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
|
26 |
|
27 | return window.history && 'pushState' in window.history;
|
28 | };
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | export var supportsPopStateOnHashChange = function supportsPopStateOnHashChange() {
|
35 | return window.navigator.userAgent.indexOf('Trident') === -1;
|
36 | };
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | export var supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() {
|
42 | return window.navigator.userAgent.indexOf('Firefox') === -1;
|
43 | };
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | export var isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) {
|
51 | return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
|
52 | }; |
\ | No newline at end of file |