You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
define([
|
|
], function () {
|
|
var Tools = {};
|
|
Tools.supportsSharedArrayBuffers = function () {
|
|
try {
|
|
return Object.prototype.toString.call(new window.WebAssembly.Memory({
|
|
shared: true,
|
|
initial: 0,
|
|
maximum: 0,
|
|
}).buffer) === '[object SharedArrayBuffer]';
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
return false;
|
|
};
|
|
|
|
|
|
Tools.isSafari = function () {
|
|
return navigator.vendor.match(/apple/i);
|
|
};
|
|
|
|
Tools.isChrome = function () {
|
|
return navigator.vendor.match(/google/i);
|
|
};
|
|
|
|
Tools.guessBrowser = function () {
|
|
if (Tools.isChrome()) { return 'chrome/blink'; }
|
|
if (Tools.isSafari()) { return 'safari/webkit'; }
|
|
if (navigator.userAgent.match(/firefox\//i)) { return 'firefox/gecko'; }
|
|
if (navigator.userAgent.match(/edge\//i)) { return 'edge/edgehtml'; }
|
|
if (navigator.userAgent.match(/trident\//i)) { return 'ie/trident'; }
|
|
return navigator.userAgent + "\n" + navigator.vendor;
|
|
};
|
|
|
|
return Tools;
|
|
});
|