12345678910111213141516171819202122232425262728293031323334 |
- // 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);
- }
- }());
|