You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2012/01/12 21:12:15 UTC

svn commit: r1230750 - /incubator/wookie/trunk/widgets/templates/base/scripts/controller.js

Author: scottbw
Date: Thu Jan 12 20:12:15 2012
New Revision: 1230750

URL: http://svn.apache.org/viewvc?rev=1230750&view=rev
Log:
Added shims in the base controller to add a "widget" object, and add a "widget.proxify" function if it doesn't exist - this enables widgets built with the templates to be opened directly in the browser or with another widget runtime such as Opera

Modified:
    incubator/wookie/trunk/widgets/templates/base/scripts/controller.js

Modified: incubator/wookie/trunk/widgets/templates/base/scripts/controller.js
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/templates/base/scripts/controller.js?rev=1230750&r1=1230749&r2=1230750&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/templates/base/scripts/controller.js (original)
+++ incubator/wookie/trunk/widgets/templates/base/scripts/controller.js Thu Jan 12 20:12:15 2012
@@ -111,6 +111,21 @@ var ${widget.shortname}_controller = {
     }
 };
 
+/**
+ * Provides a basic shim for opening the widget without a widget object (e.g. directly in browsers)
+ */
+if (!window.widget){
+    window.widget = {};
+}
+
+/**
+ * Adds in the "proxify" method if it isn't in the widget object, e.g. as we're opening the widget
+ * directly in a browser, or using a widget runtime other than Wookie e.g. Opera, PhoneGap etc
+ */
+if (!window.widget.proxify){
+    window.widget.proxify = function(url){ return url };
+}
+
 $('#home').live('pageshow',function(event) {
    ${widget.shortname}_controller.init(); 
 });