Legacy webOS versions

edited February 2012 in Enyo 1.0
So I am working on porting a Mojo app to Enyo with hopes of cross platform development. I also want it to work on legacy webOS releases, 1.4.5+, but I am running into a problem. I installed the package on a webOS 3.0.5 Touchpad a 2.2.4 Pre 2 and a 1.4.5 Pre. The Pres both have Enyo from the Maps update. The app works fine on the Touchpad and the Pre 2 but on the Pre it does not and I get this error in the logs.
Uncaught TypeError: Cannot call method 'isDescendantOf' of undefined, file:///usr/palm/frameworks/enyo/1.0/framework/build/enyo-build.js:2182
Is there a reason why it should preform diffidently on a 1.4.5 device? Or am I just missing something obvious.

Comments

  • I don't have the Maps ver of Enyo right off hand, but if you have a look at the error line, you might be able to see which function is triggering it, and have a look around there to see what might be calling it badly.
  • I ran into a similar issue when we first ported the Enyo/Bing Maps app over to legacy devices. Basically, 1.4.5 devices have an older version of JavaScript on them and I had to add a shim for the defineProperty() method to get the Maps app to work on 1.4.5 devices. You may need to do something similar for your app.
  • So looking at the enyo-build on the Pre I find this:
    // dom/Gesture.js
    
    ...
    
    endPreventFocus: function(a) {
    this.focusPrevented = !1;
    var b = enyo.keyboard.isShowing();
    this.dragEvent && !b ? this.target.blur() : this.needsCustomFocus && a && a.target && this.send("focus", a, {
    synthetic: !0,
    target: this.target
    }), this.needsCustomFocus = !1, a && (a.canFocus = !this.dragEvent || b && this._findCommonAncestor(this.dispatchTarget, a.dispatchTarget)), enyo.keyboard.resume();
    },
    sendCustomClick: function(a) {
    if (this.target !== a.target) {
    var b = this._findCommonAncestor(this.dispatchTarget, a.dispatchTarget);
    if (b) {
    a.synthetic = !0, enyo.dispatch(a), this.send("click", a, {
    synthetic: !0,
    target: b.hasNode()
    });
    return !0;
    }
    }
    },
    
    ...
    
    _findCommonAncestor: function(a, b) {
    var c = b;
    while (c) {
    if (a.isDescendantOf(c)) return c;
    c = c.parent;
    }
    },
    Were it looks like the a.dispatchTarget of sendCustomClick and endPreventFocus are coming back undefined. I'll be honest, I have no idea what this means and I don't how to relate it back to my code. The app doesn't even full load and I have not performed any gestures yet. Also the same functions appear in the enyo-build that comes from the SDK but I do not get the errors in Chrome or my other webOS devises. Also if c is undefined shouldn't it skip over the while?
  • Can you test using the enyo-build.js file from the enyo-1.0 open source release instead of the one installed with maps? I'm not sure if it will work better, but it's a lot easier to match error messages to those source files.
  • Ok I replaced the framework folder on the Pre with the one downloaded from github. New error, same app behavior.
    Uncaught TypeError: Cannot read property 'dispatchTarget' of undefined, file:///usr/palm/frameworks/enyo/1.0/framework/build/enyo-build.js:2238
    Assuming that this line numbers are the same as I see them in github the function in which the error is thrown is:
    enyo.gesture.requiresDomMousedown = function(a) {
    return a.dispatchTarget.requiresDomMousedown || a.detail == 2;
    },
  • OK, when do you see this message in the logs. It looks like it should only happen when handling a mouseup or mousedown event. Do you actually get bad behavior or is it just a log problem?
  • Ok, so I don't know what was causing there errors to popup, I couldn't duplicate them so I began commenting out sections of code to see if I could find were it was getting hung up at, and it the behavior seemed to have something to do with a call to localStorage. I think I can work around it. It is still interesting that it I didn't get that behavior on the other versions of webOS. Thanks for the help.
  • localStorage is not implemented on 1.4.5, although I don't recall getting any weird errors like that when I brought GVoice over to the Pre ..
  • I could see a failed call to localStorage causing something else to fail. Yeah, that's the likely problem -- it was an addition to WebKit in the update we made for webOS 2.0.
  • I see. Well thanks for all the help, and hey I learned something!
Sign In or Register to comment.