Split service component from widgets and introduce
host->plugin communication

Change-Id: I2377059dfc30c196a5b24d331fe60f0310694ba1
diff --git a/dev/js/src/view.js b/dev/js/src/view.js
index 4885afa..fa830d6 100644
--- a/dev/js/src/view.js
+++ b/dev/js/src/view.js
@@ -78,14 +78,17 @@
      * Close the view.
      */
     close : function () {
+
+      // Close embedded things before
+      if (this.onClose)
+        this.onClose();
+
       var e = this.element();
       if (e.parentNode) {
         e.parentNode.removeChild(e);
       };
       this.panel.delView(this);
       this._shown = false;
-      if (this.onClose)
-        this.onClose();
     },
 
     /**