Firefox OS/Stingray/Hybrid Widget Model: Difference between revisions

m
Lakrits moved page FirefoxOS/Stingray/Hybrid Widget Model to Firefox OS/Stingray/Hybrid Widget Model: The official spelling of "Firefox OS" leaves a space between the two parts of the name. It's easier to find a page if the spelling of its name...
m (Lakrits moved page FirefoxOS/Stingray/Hybrid Widget Model to Firefox OS/Stingray/Hybrid Widget Model: The official spelling of "Firefox OS" leaves a space between the two parts of the name. It's easier to find a page if the spelling of its name...)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Hybrid Widget Model ==
Hybrid Widget Model means homescreen has more power and responsibilities. A homescreen app may manage and host widgets in itself no longer needing system app's support, unlike 2-layered widget model. All apps opened by homescreen app are still managed and hosted by system app.


=== Limitations ===
* Users cannot have multiple instances of the same widget with different configurations (need new API support)
* A widget cannot open new screen, excepting using mozApps.getSelf().launch()
== Prerequisite ==
The homescreen app of hybrid widget model may depends on the following bugs. We need all of permission bugs fixed to have a privileged homescreen app. We will create a certified homescreen app when they are not ready.
''' permission bugs '''
* {{bug|899994}} mozApp.mgmt: web app management, like list, install, uninstall apps.
* '''no bug''' embed-apps: assign iframe mozApp attribute
* {{bug|819882}} open-remote-window: window.open(url, "remote");
''' wallpaper '''
* {{bug|900551}} Settings API --  for getting wallpaper image
* {{bug|917416}} Let Homescreen App draw the wallpaper
''' other gecko bugs '''
* {{bug|879475}} nested OOP iframe
* {{bug|989198}} hardware key button events
== Item List ==
=== Homescreen Base ===
* supporting libraries, like spatial navigation, selection border.
* app list
=== Widget Editor ===
* layout editor for customizing widget position
* widget editor for choosing widget
* persistence module for saving the editing result
=== Widget Manager ===
* widget life-cycle management
=== Build System ===
* pack and build correct homescreen
* change default homescreen
=== Sample Widgets ===
* 2048
== Others ==
=== Class Definition Style ===
Class definition should use the following convention:
  /* global BrowserConfigHelper, WidgetWindow, Applications */
  'use strict';
 
  (function(exports) {
 
    var WidgetFactory = function() {
    };
 
    WidgetFactory.prototype = {
      createWidget: function(args) {
        var manifestURL = args.widgetOrigin + '/manifest.webapp';
        var appInfo = Applications.getByManifestURL(manifestURL);
        if (!appInfo.manifest) {
          return;
        }
       
        var appURL = args.widgetOrigin + (args.widgetEntryPoint ?
          appInfo.manifest.entry_points[args.widgetEntryPoint].launch_path :
          appInfo.manifest.launch_path);
       
        var config = new BrowserConfigHelper(appURL, manifestURL);
       
        var widgetOverlay =
          document.getElementsByClassName('widget-overlay')[0];
        var app = new WidgetWindow(config, widgetOverlay);
        // XXX: Separate styles.
        app.setStyle(args);
        this.publish('launchwidget', app.instanceID);
       
        return app;
      },
     
      publish: function wf_publish(event, detail) {
        var evt = document.createEvent('CustomEvent');
        evt.initCustomEvent(event, true, false, detail);
        window.dispatchEvent(evt);
      }
    };
   
    exports.WidgetFactory = WidgetFactory;
  }(window));
3,860

edits