You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
776 B
35 lines
776 B
7 years ago
|
// by jussi-kalliokoski
|
||
|
|
||
|
|
||
|
// This test is asynchronous. Watch out.
|
||
|
|
||
|
// The test will potentially add garbage to console.
|
||
|
|
||
|
(function(){
|
||
|
try {
|
||
|
var data = 'Modernizr',
|
||
|
worker = new Worker('data:text/javascript;base64,dGhpcy5vbm1lc3NhZ2U9ZnVuY3Rpb24oZSl7cG9zdE1lc3NhZ2UoZS5kYXRhKX0=');
|
||
|
|
||
|
worker.onmessage = function(e) {
|
||
|
worker.terminate();
|
||
|
Modernizr.addTest('dataworkers', data === e.data);
|
||
|
worker = null;
|
||
|
};
|
||
|
|
||
|
// Just in case...
|
||
|
worker.onerror = function() {
|
||
|
Modernizr.addTest('dataworkers', false);
|
||
|
worker = null;
|
||
|
};
|
||
|
|
||
|
setTimeout(function() {
|
||
|
Modernizr.addTest('dataworkers', false);
|
||
|
}, 200);
|
||
|
|
||
|
worker.postMessage(data);
|
||
|
|
||
|
} catch (e) {
|
||
|
Modernizr.addTest('dataworkers', false);
|
||
|
}
|
||
|
}());
|