WinJS.Application 相关函数和源码:
stop: function () { /// /// /// Stops application event processing and resets WinJS.Application /// to its initial state. /// /// // Need to clear out the event properties explicitly to clear their backing // state. // this.onactivated = null; this.oncheckpoint = null; this.onerror = null; this.onloaded = null; this.onready = null; this.onsettings = null; this.onunload = null; listeners = new ListenerType(); WinJS.Application.sessionState = {}; running = false; copyAndClearQueue(); unregister(); cleanupAllPendingDeferrals(); }
addEventListener: function (eventType, listener, capture) { /// /// /// Adds an event listener to the control. /// /// /// The type (name) of the event. /// /// /// The listener to invoke when the event is raised. /// /// /// true to initiate capture; otherwise, false. /// /// listeners.addEventListener(eventType, listener, capture); }
removeEventListener: function (eventType, listener, capture) { /// /// /// Removes an event listener from the control. /// /// /// The type (name) of the event. /// /// /// The listener to remove. /// /// /// Specifies whether or not to initiate capture. /// /// listeners.removeEventListener(eventType, listener, capture); }
checkpoint: function () { /// /// /// Queues a checkpoint event. /// /// queueEvent({ type: checkpointET }); }
start: function () { /// /// /// Starts processing events in the WinJS.Application event queue. /// /// register(); var queue = copyAndClearQueue(); running = true; drainQueue(queue); }
queueEvent: function queueEvent(eventRecord) { /// /// /// Queues an event to be processed by the WinJS.Application event queue. /// /// /// The event object is expected to have a type property that is /// used as the event name when dispatching on the WinJS.Application /// event queue. The entire object is provided to event listeners /// in the detail property of the event. /// /// msWriteProfilerMark("WinJS.Application:Event_" + eventRecord.type + " queued,Info"); eventQueue.push(eventRecord); if (running && !pendingDrain) { drainQueue(copyAndClearQueue()); } }
oncheckpoint: function (args) { // TODO: This application is about to be suspended. Save any state // that needs to persist across suspensions here. You might use the // WinJS.Application.sessionState object, which is automatically // saved and restored across suspension. If you need to complete an // asynchronous operation before your application is suspended, call // args.setPromise(). }
onunload: undefined
onactivated: function (args) { if (args.detail.kind === activation.ActivationKind.launch) { if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { test(); // TODO: This application has been newly launched. Initialize // your application here. } else { // TODO: This application has been reactivated from suspension. // Restore application state here. } args.setPromise(WinJS.UI.processAll()); } }
onloaded: undefined
onready: undefined
onsettings: undefined
onerror: undefined
local: [object Object]
temp: [object Object]
roaming: [object Object]
sessionState: [object Object]