Created
November 4, 2012 01:25
-
-
Save thomasboyt/4009717 to your computer and use it in GitHub Desktop.
WinJS pt.1 Code Samples
This file contains 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
(function () { | |
"use strict"; | |
WinJS.Binding.optimizeBindingReferences = true; | |
var app = WinJS.Application; | |
var activation = Windows.ApplicationModel.Activation; | |
app.onactivated = function (args) { | |
if (args.detail.kind === activation.ActivationKind.launch) { | |
if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { | |
// Initialize | |
require(["app/main"]); | |
} | |
else { | |
// Restoring from suspension | |
require(["app/restore"]); | |
} | |
args.setPromise(WinJS.UI.processAll()); | |
} | |
else if (args.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.shareTarget) { | |
// Sharing | |
require(["app/share"]); | |
} | |
}; | |
app.oncheckpoint = function (args) { | |
// About to be suspended. | |
require("app/suspend"); | |
}; | |
app.start(); | |
})(); |
This file contains 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
<script src="//Microsoft.WinJS.1.0/js/base.js"></script> | |
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script> | |
<script data-main="/js/require-config" src="/js/lib/require.js"></script> | |
<script src="/js/default.js"></script> |
This file contains 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
require.config({ | |
baseUrl: '/js' | |
}); |
This file contains 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
define( | |
[ | |
"lib/some_dependency", | |
"app/some_module" | |
], | |
function(some_dependency, some_module) { | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment