zoukankan      html  css  js  c++  java
  • windows store app Lifecycle

    1.Activated 

    2.Suspended

    3.Resumed

    4.Terminated

    对应的 js代码:

    (function () {
        "use strict";
    
        WinJS.Binding.optimizeBindingReferences = true;
    
        var app = WinJS.Application;
        var activation = Windows.ApplicationModel.Activation;
    
        // 一下 1,2,3 是app 的事件触发顺序
        //1
        app.onloaded = function (args) {
            debugger;
        }
    
        //2
        app.onactivated = function (args) {
            debugger;
        };
    
        //3
        app.onready = function (args) {
            debugger;
        }
    
    
        //suspended
        app.oncheckpoint = function (args) {
            debugger;
        }
    
    
    
    
        // settings
        app.onsettings = function (args) {
            debugger;
        }
    
        app.onunload = function (args) {
            debugger;
        }
    
        //error
        app.onerror = function (args) {
            debugger;
        }
    
        app.start();
    })();

     获取 Activation type 和 previous app state

    Activation type:

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.activation.activationkind.aspx

    previous app state:

    (function () {
        "use strict";
    
        WinJS.Binding.optimizeBindingReferences = true;
    
        var app = WinJS.Application;
        var activation = Windows.ApplicationModel.Activation;
    
    
        app.onactivated = function (args) {
    
            var previousState = args.detail.previousExecutionState;
            /* previousState have five kinds of state :
            
            1.notRuning:  the app is not running
    
            2.running  :  the app is running
    
            3.suspended:  the app was suspended
    
            4.terminated: the app was terminated after  it was suspended
    
            5.closeByUser: the app was closed by user (using Alt+F4, for example)
    
            */
        };
    
     app.start();
    })();
  • 相关阅读:
    两个jquery编写插件实例
    jquery编写插件(转)
    前后端分离
    理解流式布局
    元素外边距溢出(塌陷)
    超级有用的9个PHP代码片段
    php实现redis锁机制
    php程序守护进程
    SESSION机制
    php面试
  • 原文地址:https://www.cnblogs.com/Mr-Joe/p/3195406.html
Copyright © 2011-2022 走看看