mirror of
https://github.com/servo/servo.git
synced 2025-06-25 17:44:33 +01:00
17 lines
450 B
JavaScript
17 lines
450 B
JavaScript
function makeBlob() {
|
|
return new Promise(function(resolve, reject) {
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open("GET", '/images/pattern.png');
|
|
xhr.responseType = 'blob';
|
|
xhr.send();
|
|
xhr.onload = function() {
|
|
resolve(xhr.response);
|
|
};
|
|
});
|
|
}
|
|
|
|
addEventListener("message", () => {
|
|
makeBlob().then(createImageBitmap).then(bitmap => {
|
|
postMessage(bitmap, [bitmap]);
|
|
});
|
|
});
|