-
-
Save tonyfast/27d99cf9125cc35b81eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<span id="output"></span> | |
</body> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
<script src="main.js"></script> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var worker = new Worker('worker.js'); | |
worker.onmessage = function(event) { | |
$('#output').text('Output is: ' + event.data); | |
}; | |
worker.postMessage('foo'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.onmessage = function(event) { | |
var req = indexedDB.open('mydb', 1); | |
req.onupgradeneeded = function (e) { | |
self.postMessage('successfully upgraded db'); | |
}; | |
req.onsuccess = function (e) { | |
self.postMessage('successfully opened db'); | |
}; | |
req.onerror = function(e) { | |
self.postMessage('error'); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment