Skip to content

Commit

Permalink
Added metadata to "workers" detects
Browse files Browse the repository at this point in the history
  • Loading branch information
stucox committed May 22, 2013
1 parent ba8ad6b commit ea17d40
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 8 deletions.
24 changes: 20 additions & 4 deletions feature-detects/workers/blobworkers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
/*!
{
"name": "Workers from Blob URIs",
"property": "blobworkers",
"caniuse" : "blobworkers",
"tags": ["performance", "workers"],
"notes": [{
"name": "W3C Reference",
"href": "http://www.w3.org/TR/workers/"
}],
"knownBugs": ["This test may output garbage to console."],
"author": "Jussi Kalliokoski",
"async": true
}
!*/
/* DOC
Detects support for creating Web Workers from Blob URIs.
*/
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
// by jussi-kalliokoski
// This test is asynchronous. Watch out.
// The test will potentially add garbage to console.

Modernizr.addAsyncTest(function() {
try {
// we're avoiding using Modernizr._domPrefixes as the prefix capitalization on
Expand Down
24 changes: 20 additions & 4 deletions feature-detects/workers/dataworkers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
// by jussi-kalliokoski
// This test is asynchronous. Watch out.
// The test will potentially add garbage to console.
/*!
{
"name": "Workers from Data URIs",
"property": "dataworkers",
"caniuse" : "dataworkers",
"tags": ["performance", "workers"],
"notes": [{
"name": "W3C Reference",
"href": "http://www.w3.org/TR/workers/"
}],
"knownBugs": ["This test may output garbage to console."],
"author": "Jussi Kalliokoski",
"async": true
}
!*/
/* DOC
Detects support for creating Web Workers from Data URIs.
*/
define(['Modernizr', 'addTest'], function( Modernizr, addTest ) {
Modernizr.addAsyncTest(function() {
try {
var data = 'Modernizr',
Expand Down
17 changes: 17 additions & 0 deletions feature-detects/workers/sharedworkers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*!
{
"name": "Shared Workers",
"property": "sharedworkers",
"caniuse" : "sharedworkers",
"tags": ["performance", "workers"],
"notes": [{
"name": "W3C Reference",
"href": "http://www.w3.org/TR/workers/"
}]
}
!*/
/* DOC
Detects support for the `SharedWorker` API from the Web Workers spec.
*/
define(['Modernizr'], function( Modernizr ) {
Modernizr.addTest('sharedworkers', !!window.SharedWorker);
});
26 changes: 26 additions & 0 deletions feature-detects/workers/webworkers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/*!
{
"name": "Web Workers",
"property": "webworkers",
"caniuse" : "webworkers",
"tags": ["performance", "workers"],
"notes": [{
"name": "W3C Reference",
"href": "http://www.w3.org/TR/workers/"
}, {
"name": "HTML5 Rocks article",
"href": "http://www.html5rocks.com/en/tutorials/workers/basics/"
}, {
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en-US/docs/Web/Guide/Performance/Using_web_workers"
}],
"polyfills": [{
"fakeworker.js": "https://code.google.com/p/fakeworker-js/"
}]
}
!*/
/* DOC
Detects support for the basic `Worker` API from the Web Workers spec. Web Workers provide a simple means for web content to run scripts in background threads.
*/
define(['Modernizr'], function( Modernizr ) {
Modernizr.addTest('webworkers', !!window.Worker);
});

0 comments on commit ea17d40

Please sign in to comment.