[Tizen6.5 Migration][Service] call onRequest() when app launched again 92/257892/4
authorDongHyun Song <dh81.song@samsung.com>
Thu, 6 May 2021 05:07:58 +0000 (14:07 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Fri, 7 May 2021 07:01:47 +0000 (07:01 +0000)
When the app launched again, onRequest() event will
be called to handle different appcontrol data.

Reference:
https://review.tizen.org/gerrit/#/c/platform/framework/web/wrtjs/+/257913/

Change-Id: I255d9882f79196b60f77f3504a7d012963f60c1c
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt_app/common/service_manager.ts
wrt_app/common/service_runner.ts

index a1e5af6..66213f6 100644 (file)
@@ -13,8 +13,10 @@ Object.defineProperty(global, 'serviceType', {
 });
 
 function createWorker(id: string, startService: string, filename: string) {
-  if (workers[id])
+  if (workers[id]) {
+    workers[id].postMessage({ type: 'wake' });
     return;
+  }
 
   workers[id] = new Worker(startService, {
     workerData: {
index 4c62afb..f4a9228 100644 (file)
@@ -138,7 +138,9 @@ function run() {
     return;
   parentPort.on('message', (message) => {
     console.log(`Received message type : ${message.type}`);
-    if (message.type === 'stop') {
+    if (message.type === 'wake') {
+      app?.onRequest();
+    } else if (message.type === 'stop') {
       stop(id);
       setTimeout(() => {
         XWalkExtension.cleanup();