(WebOS-ports/webos-lib): Any examples of AppMenu and PalmService?

edited November 2013 in Enyo 2
Hello. I am trying to use the enyo2 kinds available at https://github.com/webOS-ports/webos-lib for integration with webOS. I am having trouble getting the AppMenu and the PalmService kinds to work. I'd like to use AppMenu to get the palm menu to work on TouchPad, and I'd like to use PalmService to connect to the mail service.

Here is how I am trying to integrate AppMenu:
{kind: "enyo.AppMenu", components: [
      {caption: "Menu item 1", ontap: "tapOpenMenu1"},
      {caption: "Menu item 2", ontap: "tapOpenMenu2"},
      {caption: "Menu item 3", ontap: "tapOpenMenu3"},
      {caption: "Menu item 4", ontap: "tapOpenMenu4"},
]}
Here is how I am trying to integrate PalmService:
{kind : "enyo.PalmService", name : "launchApp", service : "palm://com.palm.applicationManager", method : "launch", onSuccess : "launchAppSuccess", onFailure : "launchAppFailure", subscribe : true },
[...]
var params= {"summary":"Bla bla bla, email subject line", "text":"Bla bla bla, email body"};
this.$.launchApp.call({ "id": "com.palm.app.email", "params":params});
[...]
var params = { "scene":"page", "target":"... my palm store URL ..."};
this.$.launchApp.call({ "id": "com.palm.app.enyo-findapps", "params":params});
Neither of these approaches are working. I don't see any error messages in the palm logs. Do you have any tips?

Comments

  • edited November 2013
    in your Appmenu try
    {kind:"AppMenu", onSelect: "ItemSelected", components: [
          {caption: "Menu item 1"},
          {caption: "Menu item 2"},
          {caption: "Menu item 3"},
          {caption: "Menu item 4"},
    
    ]}
    then in the function check the inEvent.originator.content to see what was call
    ItemSelected: function(inSender, inEvent) {
    		if (inEvent.originator.content){............
    that should get you going in the right direction
    john
  • This is using PalmService calls:
    https://github.com/webOS-ports/org.webosports.update/blob/master/app/source/UpdateApp.js

    I'm not sure, why, but on my PalmService kinds I do "send", not call. This worked for me on 3.0.5 and open webOS.

    This uses the app menu and worked on webOS 3.0.5:
    https://github.com/webOS-ports/preware/blob/master/source/App.js

    A different ontap for every app menu-entry worked for me... not sure what should be wrong in your code.
  • I'm not sure why AppMenu isn't work; I'm not the author of that component.

    But in regards to PalmService, I'd like to refer you to http://webos-ports.github.io/webos-lib/#enyo.PalmService the documentation page. send() is the function to execute the service request (with request parameters passed there. And instead of onSuccess/onFailure/onComplete, it uses onResponse, onError, and onComplete.
  • Check and make sue that the ( lib/webos-lib/package.js ) has a "source" in it
    it seams to have got lost some were. its missing in the webos-ports-template right now but i have a pull to fix it and up date to current enyo
    john
  • This is kind of old, but it seems like an appropriate thread to post this in. I added webos-lib to my Enyo2 app, and it works, but when it opens, it is not large enough and cuts off the last item. If I scroll down to it, it automatically scrolls back to the top of the list. I copied the app menu code from the Preware2 source, and everything works, it's just all cut off. What am I missing?
  • Actually, I just noticed that the AppMenu is also too small in Preware2 (on LuneOS anyway..), except the text of the last item shows past the bottom of the menu background instead of being hidden. For now, I just added one extra item with the text '...' that is hidden below the fold in my app menu. I looked at the code for the AppMenu kind briefly, and saw it was specifically setting its size assuming some extra space for the scroller, so perhaps that behavior has changed in Enyo2 (2.4.0-pre.3)? Will have to see if it behaves the same with with older versions..
  • Yes i have notice that! been working on it. Just got to make the merge master happy. You can try my fix from my git hub https://github.com/micro-tech/webos-lib

    john
Sign In or Register to comment.