-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathhas.js
More file actions
33 lines (26 loc) · 751 Bytes
/
has.js
File metadata and controls
33 lines (26 loc) · 751 Bytes
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
'use strict';
// hacky simple implementation of has
const globalAudioContext = require('./shims/AudioContext');
function has(check){
if(check == 'shittySound'){
return !!((has('android') || has('ios')) && has('webkit'));
}
else if(check == 'android'){
return (parseFloat(navigator.userAgent.split("Android ")[1]) || undefined);
}
else if(check == 'ios'){
//TODO need something for this
return false;
}
else if(check == 'webkit'){
return (parseFloat(navigator.userAgent.split("WebKit/")[1]) || undefined);
}
else if(check == 'WebAudio'){
return !!global.AudioContext;
}
else if (check === 'touch') {
return 'ontouchstart' in document.documentElement;
}
return false;
}
module.exports = has;