|
把config 配置 一下 入口文件该我这个页面
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title>Hello APP</title>
- <link rel="stylesheet" type="text/css" href="./css/api.css" />
- <style type="text/css">
- html,
- body {
- height: 100%;
- font-size: 20px;
- }
- .wrap {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-flex-flow: column;
- }
- header {
- height: 44px;
- width: 100%;
- text-align: center;
- background-color: #81a9c3;
- color: #fff;
- line-height: 44px;
- font-size: 20px;
- }
- .flex-1 {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- }
- footer {
- height: 30px;
- width: 100%;
- background-color: #81a9c3;
- color: white;
- line-height: 30px;
- text-align: center;
- }
- input{
- width: 200px;
- height: 60px;
- border-radius: 5px;
- border: 1px solid #b33;
- }
- button{
- width: 100%;
- height: 50px;
- }
-
- </style>
- </head>
- <body class="wrap">
- <h1>66666666</h1>
- <h1>66666666</h1>
- <h1>66666666</h1>
- <h1>66666666</h1>
- <h1>66666666</h1>
- <h1>66666666</h1>
- <h1>66666666</h1>
- <h1>66666666</h1>
- <h1>66666666</h1>
- </body>
- <script type="text/javascript" src="./script/api.js"></script>
- <script type="text/javascript">
- var pTime = 0;//离开时间
- var rTime = 0;//返回时间
- apiready = function() {
- api.addEventListener({
- name:'pause'
- }, function(ret, err){
- pTime = new Date().getTime();
- });
-
- api.addEventListener({
- name: 'resume'
- }, function(ret, err) {
- setTimeout(function(){
- rTime = new Date().getTime();
- var ttime = rTime - pTime;
- console.log( rTime +','+ pTime +','+ ttime);
- if(ttime > 20000){
- api.rebootApp();
- }else{
- alert( ttime + 'ms 后 ,回到前台');
- };
- },1000)
- });
- }
- </script>
- </html>
复制代码 |
|