[Addon] Add new event 'contentDidFinishLoad' 32/215332/4 submit/tizen/20191008.003900
authorhyunduk.kim <hyunduk.kim@samsung.com>
Fri, 27 Sep 2019 06:13:51 +0000 (15:13 +0900)
committerHyunduk Kim <hyunduk.kim@samsung.com>
Tue, 8 Oct 2019 00:33:48 +0000 (00:33 +0000)
This event is for the timing when WebContents emits
'did-finish-load'.
The document[1] says that it is emitted when the navigation
is done, i.e. the spinner of the tab has stopped spinning,
and the 'onload' event was dispatched.

[1] https://electronjs.org/docs/api/web-contents#event-did-finish-load

Change-Id: I335f26e9efc2c5f1280f25e496d5418e8d75440c
Signed-off-by: hyunduk.kim <hyunduk.kim@samsung.com>
wrt_app/src/addon_manager.js
wrt_app/src/runtime.js
wrt_app/src/web_application.js

index 378cf4f..7bfb7f1 100644 (file)
@@ -27,12 +27,13 @@ const ADDONS_DB_FILE = 'addons_db.json';
 let EventList = [
     'newListener',      // A listener is added via on() or addListener()
     'removeListener',   // A listener is removed via off() or removeListener()
-    'lcPrelaunch',     // An app is at just before launching
-    'lcResume',        // An app is resumed
-    'lcSuspend',       // An app is suspended
-    'lcQuit',          // An app is quitted
-    'hwDownkey',       // Down key is pressed
-    'hwUpkey'          // Up key is pressed
+    'lcPrelaunch',      // An app is at just before launching
+    'lcResume',         // An app is resumed
+    'lcSuspend',        // An app is suspended
+    'lcQuit',           // An app is quitted
+    'hwDownkey',        // Down key is pressed
+    'hwUpkey',          // Up key is pressed
+    'contentDidFinishLoad' // The navigation is done and 'onload' was dispatched
 ];
 Object.freeze(EventList);
 
index 43c7f7f..d6df801 100755 (executable)
@@ -118,6 +118,8 @@ class Runtime {
                             _this.addonManager.isAddonAvailable();
                     options.launchMode = launchMode;
                     _this.webApplication = new WebApplication(options);
+                    _this.webApplication.addonEmitter =
+                          _this.addonManager.evt_emitter_;
                     _this.inspectorEnabledByVconf = wrt.needUseInspector();
                     if (_this.inspectorEnabledByVconf && launchMode != 'backgroundExecution') {
                         _this.webApplication.inspectorSrc = src;
index b487d3f..ccb380c 100755 (executable)
@@ -57,6 +57,7 @@ class WebApplication {
         this.defaultBackgroundColor = (this.isTVProfile
             || (wrt.getPlatformType() === "product_wearable") ? '#000' : '#FFF');
         this.defaultTransparent = (this.isTVProfile ? true : false);
+        this.addonEmitter = null;
 
         let self = this;
         app.on('browser-window-created', function(event, window) {
@@ -256,6 +257,7 @@ class WebApplication {
                     self.suspendByStatus();
                 }
             }
+            self.addonEmitter.emit('contentDidFinishLoad', self.mainWindow.id);
         });
     }
     suspendByStatus() {