src/Builder4/DialogPluginWebkit.bjs
authorAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 09:20:20 +0000 (17:20 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 16 Apr 2015 09:20:20 +0000 (17:20 +0800)
src/Builder4/DialogPluginWebkit.vala

src/Builder4/DialogPluginWebkit.bjs
src/Builder4/DialogPluginWebkit.vala

index 3829052..67b3575 100644 (file)
@@ -35,6 +35,9 @@
        "$ xns" : "Gtk",
        "items" : [
         {
+         "listeners" : {
+          "load_changed" : "(le) => {\n    if (le != WebKit.LoadEvent.FINISHED) {\n        return;\n    }\n    if (this.runjs.length < 1) {\n        return;\n    }\n  //  this.el.run_javascript(this.runjs, null);\n     FakeServerCache.remove(    this.runjs);\n    this.runjs = \"\";\n}"
+         },
          "id" : "webview",
          "* init" : " {\n    // this may not work!?\n    var settings =  this.el.get_settings();\n    \n     \n    //var fs= new FakeServer(this.el);\n    //fs.ref();\n    // this was an attempt to change the url perms.. did not work..\n    // settings.enable_file_access_from_file_uris = true;\n    // settings.enable_offline_web_application_cache - true;\n    // settings.enable_universal_access_from_file_uris = true;\n   \n     \n    \n    \n    \n\n     // FIXME - base url of script..\n     // we need it so some of the database features work.\n    this.el.load_html( \"Render not ready\" , \n            //fixme - should be a config option!\n            // or should we catch stuff and fix it up..\n            \"xhttp://localhost/app.Builder/\"\n    );\n        \n        \n    \n    \n}\n",
          "xtype" : "WebView",
index ccefe65..f9c39eb 100644 (file)
@@ -234,6 +234,19 @@ public class Xcls_DialogPluginWebkit : Object
                 
                 
             }
+
+            // listeners 
+            this.el.load_changed.connect( (le) => {
+                if (le != WebKit.LoadEvent.FINISHED) {
+                    return;
+                }
+                if (this.runjs.length < 1) {
+                    return;
+                }
+              //  this.el.run_javascript(this.runjs, null);
+                 FakeServerCache.remove(    this.runjs);
+                this.runjs = "";
+            });
         }
 
         // user defined functions