Posts

Showing posts from February, 2012

Packaging a JavaScript Metro Style App in Windows 8

Image
The Metro Apps documentation uses a C# as an example. Just so we all know, we can compile a deliverable of our Metro Style JavaScript application by right-licking the *project* and picking "Store", "Create an App Package". We can now configure a few settings for the application, as the version number. Remember to set the solution to deploy as "Release" instead of "Debug" so the final files don't have "_debug" names. Also, make sure you customized the "PackageName" field on the manifest, under the "Packaging" tab, or the id will be used later by validation tools, and it would be harder to figure out which is our app. There will be typically four files: - Batchfile with PowerShell install script - Actual .appx solution - .cer certificate base on the compiled machine name - There will also be a .appxupload file we can later submit over to the app store . The "Add-AppxDevPackage.bat" scrip...

XMLHttpRequest get url of request

Problem: When downloading files with xhr (xml http request) we need to set a callback to the onreadystatechange property, which does not allow sending arguments such as the current url being downloaded (which also can't be retrieved from the xhr instance). This is usually an issue when downloading multiple files, and specially when we want to maintain the file names. Solution: Use "closures" by immediately defining the function on the onreadystatechange property and calling a method inside it, instead of using a callback (e.g. onreadystatechange=mycallback; ). string url = "http://myurl.com/myfile.extension"; Client = new XMLHttpRequest();             if (Client) {                 Client.onreadystatechange = function () {                     readyStateCallBa...