Enyo 1.0 on Playbook simulator

edited February 2012 in Packaging Apps
I'm trying to port one of my Enyo1.0 apps to RIM's Playbook. I read some of the posts here and found some useful tricks but now it seems I stuck. The app gets copied to the simulator and launches but somehow the base enyo object isn't created. Every text I write into the index.html is visible but no enyo app is generated on the screen. Here is the layout of my project folder:

appinfo.json
config.xml
depends.js
framework_config.json
icon.png
index.html
Enyo/framework/...
images/...
source/Wikay.js
source/Wikay.css


depends.js looks like this

enyo.depends(
"source/Wikay.js",
"source/Wikay.css"
);


What could be wrong? And how could I debug it? Attaching the Chrome browser to the simulator port 1337 doesn't show my index.html at all.

Comments

  • The easiest (and only real way) to debug on Playbook is to upload it to your website, then use the debugger in the Playbook Browser. Yeah, clumsy, but it's the only debugging method I know of that works.

    Is "Enyo/framework/..." in proper case? I know iOS specifically requires proper case on all files, but not sure about playbook (had already fixed mine from iOS).
  • edited February 2012
    have a look at the script lines in your index.html?

    Also, try to load your index.html from Chrome..


  • edited February 2012
    Thank you for your answers. My index.html looks just like this:
    <!doctype html>
    
    
    	Wikay (HD)
    	
    
    
    Test 1
    
    	new Wikay().renderInto(document.body);
    
    Test 2
    
    

    The only output on the simulator is "Test 1 Test 2". In Chrome it works.
    The next thing I will try is to go the remote way as erupnu suggested.
  • Ok, I've found the solution...

    1st, I used Chrome to try to inspect the app on the simulator, but it doesn't work with Chrome. After using Safari, I could inspect my app and see where it hangs.

    2nd, I used setTimeout(this.doRefresh.bind(this), 1000) in my Enyo code. This works in webOS and Chrome but not in the Playbook webkit enviroment. I replaced them with enyo.job("doRefresh", enyo.bind(this, "doRefresh"), 1000); and now it works.

    Thank you all for your tips and comments.
  • This also occurs in Titanium. Some webkit implementations don't seem to have the bind method on the Function prototype so you have to add it manually like so:
    
    Function.prototype.bind = function (bind) {
        var self = this;
        return function () {
            var args = Array.prototype.slice.call(arguments);
            return self.apply(bind || null, args);
        };
    };
    
  • The bind function is actually a feature of the prototype framework that can be substituted with the enyo.bind function. Alternatively you can just bundle prototype with your app, which is what I did.
  • Yeah, I was noticing that "bind" isn't present everywhere, the Mozilla docs seem to indicate that it's a fairly recent addition to most browsers. Enyo's seems to work though, so I use that.
  • Yes, the bind method of Function is a recent change to ECMAScript, added in ES 5, so not all JavaScript engines have it, although they all should have it soon.
Sign In or Register to comment.