Closed garymathews closed 5 years ago
@garymathews , Running the example I get this error:
[ERROR] : [Pixel] TiExceptionHandler: (main) [5,105] worker.postMessage(event.data.msg);
[ERROR] : [Pixel] TiExceptionHandler: ^
[ERROR] : [Pixel] TiExceptionHandler: TypeError: Cannot read property 'msg' of null
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.eval (eval at <anonymous> (<anonymous>:1:236), <anonymous>:6:33)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.value (ti:/events.js:50:21)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.value (ti:/events.js:107:20)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.eval (eval at <anonymous> (<anonymous>:1:236), <anonymous>:6:10)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.value (ti:/events.js:50:21)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.value (ti:/events.js:107:20)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.eval (eval at <anonymous> (<anonymous>:1:236), <anonymous>:6:10)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.value (ti:/events.js:50:21)
[ERROR] : [Pixel] TiExceptionHandler: at TiWorker.value (ti:/events.js:107:20)
[ERROR] : [Pixel] TiExceptionHandler: at /app.js:18:6
[ERROR] : [Pixel] TiExceptionHandler:
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:979)
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:837)
[ERROR] : [Pixel] TiExceptionHandler: ti.worker.TiWorkerProxy.postMessage(TiWorkerProxy.java:58)
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:979)
[ERROR] : [Pixel] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:837)
[ERROR] : [Pixel] TiExceptionHandler: ti.worker.TiWorkerProxy.postMessage(TiWorkerProxy.java:58)
Used module : 1.0.0
FR Passed.
Studio Ver: 5.1.2.201812191831 SDK Ver: 8.0.0 local build OS Ver: 10.14 Xcode Ver: Xcode 10.1 Appc NPM: 4.2.13 Appc CLI: 7.0.9 Daemon Ver: 1.1.3 Ti CLI Ver: 5.1.1 Alloy Ver: 1.13.4 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 10.0.2 Devices: ⇨ google Nexus 5 (Android 6.0.1) ⇨ google Pixel (Android 9) Module: ti.worker (1.0.0)
Also postMessage
method of worker instance (in main script) and postMessage
method inside woker script are two completely different methods (by specification).
If you'll change echo.js
from Readme to:
// subscribe to events send with postMessage
worker.addEventListener('message',function(event){
// send data back to any subscribers
// pull data from the event from the data property
worker.postMessage({msg: event.data.msg}); // <--CHANGE HERE
});
you will get infinite loop and eventually exceed maximum call stack size
ti.worker
for AndroidJIRA Ticket