Is there a definitive way to port a Cordova App to Windows 8? (Unsafe code)

100 views Asked by At

I am right now suffering the infinite pain of porting an existing Cordova App to Windows 8, I have read a lot of webs, tried a couple a 'magic' solutions but it seems it is impossible to get it up and running without any problems.

The problem is unsafe functions, I am using jQuery 2.1.4 and the App keeps shouting at me that I cannot add dynamic content, what have I tried:

  1. winstore-jscompat from MS Open Tech, with that compatibility script a couple of things of my app stops working and I don't know why, for example onclick events that are added dynamically stops working, it doesnt give me any error, just stop working. If the onclick event is added in the HTML as a template it works, for example onclick on headers and other template elements works.
  2. Rewrite appendChild function:

When I try to use 'appendChild' after rewrite it with this piece of code:

var oldAppendChild = HTMLElement.prototype.appendChild;
HTMLElement.prototype.appendChild = function() {
    var self = this;
    var args = arguments;
    return MSApp.execUnsafeLocalFunction(function() {
        return oldAppendChild.apply(self, args);
    });
};

The App crash with 'Not enough stack space' (The msg is in Spanish I think the translation is correct) at lines that were working before.

  1. Wrap unsafe functions with 'MSApp.execUnsafeLocalFunction . . .' , I have tried a couple and it seems that it work but I don't want to paste code in all the app, I am sure it is a better way to do this.

So do you have any magic trick to get this working?

0

There are 0 answers