Advertisement
patrickc

Untitled

Jan 26th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [20120126-16:54:49.506620] error: Uncaught TypeError: Object enyo.Dashboard has
  2. no method 'renderInto', Dashboard.html:9
  3. ===================
  4. Dashboard.html:
  5. <!doctype html>
  6.    <html>
  7.    <head>
  8.    <title>Dashboard</title>
  9.    <script src="enyo/framework/enyo.js" type="text/javascript"></script>
  10.    </head>
  11.    <body>
  12.    <script type="text/javascript">
  13.        enyo.create({kind: "Dashboard"}).renderInto(document.body);
  14.    </script>
  15.    </body>
  16.    </html>
  17. ==============
  18. Dashboard.js (kind: "Dashboard"):
  19.  // TODO: Disable lock when docked
  20.    enyo.kind({
  21.    name: "Dashboard",
  22.    kind: "HFlexBox",
  23.    components: [
  24.        { name: "setDisplayProperty", kind: "PalmService", service: "palm://com.palm.display/control/", method: "setProperty" },
  25.        { name: "getDisplayProperties", kind: "PalmService", service: "palm://com.palm.display/control/", method: "getProperty", onSuccess: "gotDisplayProperties", onResponse: "gotDisplayProperties" },
  26.        { w: "fill", content: "Disable Screen Lock: ", domStyles: {padding: "8px" } },
  27.        { kind: "ToggleButton", onChange: "buttonToggle" },
  28.    ],
  29.    create: function()
  30.    {
  31.        this.log();
  32.        this.inherited(arguments);
  33.        this.$.getDisplayProperties.call( { properties: ['timeout'] } );
  34.        enyo.application.app = this;
  35.    },
  36.    gotDisplayProperties: function(inSender, inResponse)
  37.    {
  38.        this.OriginalTimeout = inResponse.timeout;
  39.        if(this.OriginalTimeout >= 86400)
  40.            this.OriginalTimeout = 3000;
  41.        this.log("display timeout=", this.OriginalTimeout);
  42.    },
  43.    buttonToggle: function(inSender, inState)
  44.    {
  45.        this.log("Toggled to state " + inState);
  46.        this.setScreenLock(!inState);
  47.    },
  48.    setScreenLock: function(on)
  49.    {
  50.        this.log(on);
  51.        if(on) {
  52.            this.$.setDisplayProperty.call( { timeout: this.OriginalTimeout });
  53.        } else {
  54.            this.$.getDisplayProperties.call( { properties: ['timeout'] } );
  55.            this.$.setDisplayProperty.call( { timeout: 86400 });
  56.        }
  57.    },
  58.    cleanup: function()
  59.    {
  60.        this.$.setDisplayProperty.call( { timeout: this.OriginalTimeout } );
  61.    }
  62.    });
  63. ==========================
  64. Media.js (my main pane):
  65. enyo.kind({
  66.     name: "Media",
  67.     kind: enyo.VFlexBox,
  68.     components: [
  69.     {kind: "ApplicationEvents", onUnload: "cleanup"},
  70.     {name: "mainPane", flex: 1, kind: "Pane", onclick: "paneClick", transitionKind: "enyo.transitions.Simple", components: [
  71.             {kind:"VFlexBox", components: [
  72.                 {kind: "PageHeader", components: [
  73.                     {kind: "VFlexBox", flex: 1, components: [
  74.                         {content: "WJGM Radio (Enyo)"},
  75.                         {content: "WJGM 105.1 FM Jacksonville FL, The Gospel", style: "font-size: 14px"}
  76.                     ]},
  77.                 ]},
  78.                 {kind: "Button", caption: "Play High Stream", onclick: "audioView"},
  79.                 {kind: "Button", caption: "Play Lo Stream", onclick: "audioViewLo"},
  80.                 /* Don't need toaster yet
  81.                 {kind: "Button", caption: "Help", onclick: "showToaster"},
  82.                 {kind: "Toaster", flyInFrom: "right", components: [
  83.                     {content: "Are you sure?"},
  84.                         {layoutKind: "HFlexLayout", pack: "center", components: [
  85.                         {kind: "Button", caption: "OK", onclick: "confirmClick"},
  86.                         {kind: "Button", caption: "Cancel", onclick: "cancelClick"}
  87.                     ]}
  88.                 ]},
  89.                 */
  90.                 {kind: "AppMenu", components: [
  91.                     {kind: "EditMenu"},
  92.                     {caption: "Preferences ...", onclick: "showPrefs"},
  93.                     {caption: "Help ...", onclick: "showHelp"},
  94.                 ]}
  95.             ]},
  96.             {name: "audioView", kind: "AudioView", onBack:"backHandler"},
  97.             {name: "audioViewLo", kind: "AudioViewLo", onBack:"backHandler"},
  98.             {name: "helpView", kind: "HelpView", onBack: "backHandler"},
  99.             {name: "prefsView", kind: "PrefsView", onBack: "backHandler"},
  100.         ]}
  101.     ],
  102.     create: function() {
  103.         this.inherited(arguments);
  104.         this.log();
  105.         enyo.windows.openDashboard ("Dashboard.html", "Dashboard", {}, {});
  106.     },
  107.     cleanup: function() {
  108.         enyo.application.app.cleanup();
  109.         this.log("Cleanup called");
  110.     },
  111.     audioView: function(){
  112.         this.$.mainPane.selectViewByName("audioView");
  113.     }, 
  114.     audioViewLo: function(){
  115.         this.$.mainPane.selectViewByName("audioViewLo");
  116.     },
  117.     showHelp: function() {
  118.         this.$.mainPane.selectViewByName("helpView");
  119.     }, 
  120.     showPrefs: function() {
  121.         this.$.mainPane.selectViewByName("prefsView");
  122.     },
  123.     backHandler: function(inSender, e) {
  124.         this.$.mainPane.back();
  125.     }
  126.     /* No need for toaster yet
  127.     showToaster: function() {
  128.     this.$.toaster.open();
  129.     },
  130.     confirmClick: function() {
  131.         this.$.mainPane.selectViewByName("helpView");
  132.         // process confirmation
  133.         this.doConfirm();
  134.         // then close dialog
  135.         this.$.toaster.close();
  136.     },
  137.     cancelClick: function() {
  138.         this.$.toaster.close();
  139.     }
  140.     */
  141. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement