Created
May 14, 2015 10:21
-
-
Save EionRobb/b77d188887c8f017219d to your computer and use it in GitHub Desktop.
Removing WinJS from Cordova.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Replace | |
var onWinJSReady = function () { | |
var app = WinJS.Application; | |
var checkpointHandler = function checkpointHandler() { | |
cordova.fireDocumentEvent('pause'); | |
}; | |
var resumingHandler = function resumingHandler() { | |
cordova.fireDocumentEvent('resume'); | |
}; | |
app.addEventListener("checkpoint", checkpointHandler); | |
Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false); | |
app.start(); | |
}; | |
if (!window.WinJS) { | |
// <script src="//Microsoft.WinJS.1.0/js/base.js"></script> | |
var scriptElem = document.createElement("script"); | |
scriptElem.src = "//Microsoft.WinJS.1.0/js/base.js"; | |
scriptElem.addEventListener("load", onWinJSReady); | |
document.head.appendChild(scriptElem); | |
console.log("added WinJS ... "); | |
} | |
else { | |
onWinJSReady(); | |
} | |
// With | |
var suspendingHandler = function suspendingHandler() { | |
cordova.fireDocumentEvent('pause'); | |
}; | |
var resumingHandler = function resumingHandler() { | |
cordova.fireDocumentEvent('resume'); | |
}; | |
var activatedHandler = function activatedHandler(e) { | |
if (typeof handleOpenURL == 'function' && e.uri) { | |
handleOpenURL(e.uri.rawUri); | |
} | |
}; | |
var wui = Windows.UI.WebUI.WebUIApplication; | |
wui.addEventListener("activated", activatedHandler, false); | |
wui.addEventListener("suspending", suspendingHandler, false); | |
wui.addEventListener("resuming", resumingHandler, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment