@pelagiccreatures/sargasso
Advanced tools
Comparing version 0.5.12 to 0.5.13
@@ -9,3 +9,3 @@ class myClass extends sargasso.Sargasso { | ||
const frame = () => { | ||
this.element.innerHTML = '<p>Hello There Viewport!' | ||
this.element.innerHTML = '<p>Hello There Viewport! Starting offloaded task in web worker so things are still responsive here.' | ||
this.element.style.color = 'red' | ||
@@ -21,14 +21,14 @@ this.addClass('animated') | ||
const code = `onmessage = function(e) { | ||
console.log('starting web worker work') | ||
for(let i = 0; i < e.data; i++){ | ||
// do something 100k times | ||
} | ||
postMessage({status:'ok'}) | ||
}` | ||
console.log('starting web worker work') | ||
for(let i = 0; i < e.data; i++){ | ||
// do something lots of times | ||
} | ||
postMessage('done counting to ' + e.data) | ||
}` | ||
const worker = this.startWorker('myworkId', code) | ||
worker.onmessage = function (e) { | ||
this.element.innerHTML = 'done counting to 100k' | ||
worker.onmessage = (e) => { | ||
this.element.innerHTML = e.data | ||
this.stopWorker('myworkId') | ||
} | ||
worker.postMessage(1000000) | ||
worker.postMessage(10000000) | ||
} | ||
@@ -35,0 +35,0 @@ } |
@@ -306,3 +306,3 @@ /** | ||
startWorker (id, code) { | ||
const blob = new Blob(code, { | ||
const blob = new Blob([code], { | ||
type: 'text/javascript' | ||
@@ -309,0 +309,0 @@ }) |
{ | ||
"name": "@pelagiccreatures/sargasso", | ||
"version": "0.5.12", | ||
"version": "0.5.13", | ||
"description": "Simple, Fast, Reactive, supervised Javascript controllers for html elements.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181720