mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
ionic.Platform.exitApp(), always run onPlatformReady()
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
- CustomEvent polyfill improvements for Android
|
||||
- Fix tab icon alignments
|
||||
- Fix $ionicPlatform.ready()
|
||||
- Fire off ionic.Platform.ready() callbacks for both Cordova and non-cordova
|
||||
- Created ionic.Platform.exitApp();
|
||||
|
||||
|
||||
## 0.9.22 "Alpha Narwhal" (2014-01-30)
|
||||
|
||||
2
dist/js/ionic-angular.js
vendored
2
dist/js/ionic-angular.js
vendored
@@ -672,7 +672,7 @@ angular.module('ionic.service.view', ['ui.router', 'ionic.service.platform'])
|
||||
$rootScope.$viewHistory.backView.go();
|
||||
} else {
|
||||
// there is no back view, so close the app instead
|
||||
navigator.app.exitApp();
|
||||
ionic.Platform.exitApp();
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
|
||||
2
dist/js/ionic-angular.min.js
vendored
2
dist/js/ionic-angular.min.js
vendored
File diff suppressed because one or more lines are too long
27
dist/js/ionic.js
vendored
27
dist/js/ionic.js
vendored
@@ -1788,7 +1788,7 @@ window.ionic = {
|
||||
|
||||
device: function() {
|
||||
if(window.device) return window.device;
|
||||
console.error('device plugin required');
|
||||
if(this.isCordova()) console.error('device plugin required');
|
||||
return {};
|
||||
},
|
||||
|
||||
@@ -1853,6 +1853,10 @@ window.ionic = {
|
||||
return navigator.userAgent.toLowerCase().indexOf(type.toLowerCase()) >= 0;
|
||||
},
|
||||
|
||||
exitApp: function() {
|
||||
navigator.app && navigator.app.exitApp && navigator.app.exitApp();
|
||||
},
|
||||
|
||||
showStatusBar: function(val) {
|
||||
// Only useful when run within cordova
|
||||
this.showStatusBar = val;
|
||||
@@ -1891,19 +1895,26 @@ window.ionic = {
|
||||
|
||||
};
|
||||
|
||||
var readyCallbacks = [];
|
||||
var platformName;
|
||||
var platformVersion;
|
||||
var platformName,
|
||||
platformVersion,
|
||||
readyCallbacks = [];
|
||||
|
||||
// setup listeners to know when the device is ready to go
|
||||
function onWindowLoad() {
|
||||
// window is loaded, now lets listen for when the device is ready
|
||||
document.addEventListener("deviceready", onCordovaReady, false);
|
||||
if(ionic.Platform.isCordova()) {
|
||||
// the window and scripts are fully loaded, and a cordova/phonegap
|
||||
// object exists then let's listen for the deviceready
|
||||
document.addEventListener("deviceready", onPlatformReady, false);
|
||||
} else {
|
||||
// the window and scripts are fully loaded, but the window object doesn't have the
|
||||
// cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova
|
||||
onPlatformReady();
|
||||
}
|
||||
window.removeEventListener("load", onWindowLoad, false);
|
||||
}
|
||||
window.addEventListener("load", onWindowLoad, false);
|
||||
|
||||
function onCordovaReady() {
|
||||
function onPlatformReady() {
|
||||
// the device is all set to go, init our own stuff then fire off our event
|
||||
ionic.Platform.isReady = true;
|
||||
ionic.Platform.detect();
|
||||
@@ -1913,7 +1924,7 @@ window.ionic = {
|
||||
}
|
||||
readyCallbacks = [];
|
||||
ionic.trigger('platformready', { target: document });
|
||||
document.removeEventListener("deviceready", onCordovaReady, false);
|
||||
document.removeEventListener("deviceready", onPlatformReady, false);
|
||||
}
|
||||
|
||||
})(window.ionic);
|
||||
|
||||
6
dist/js/ionic.min.js
vendored
6
dist/js/ionic.min.js
vendored
File diff suppressed because one or more lines are too long
2
js/ext/angular/src/service/ionicView.js
vendored
2
js/ext/angular/src/service/ionicView.js
vendored
@@ -57,7 +57,7 @@ angular.module('ionic.service.view', ['ui.router', 'ionic.service.platform'])
|
||||
$rootScope.$viewHistory.backView.go();
|
||||
} else {
|
||||
// there is no back view, so close the app instead
|
||||
navigator.app.exitApp();
|
||||
ionic.Platform.exitApp();
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
device: function() {
|
||||
if(window.device) return window.device;
|
||||
console.error('device plugin required');
|
||||
if(this.isCordova()) console.error('device plugin required');
|
||||
return {};
|
||||
},
|
||||
|
||||
@@ -97,6 +97,10 @@
|
||||
return navigator.userAgent.toLowerCase().indexOf(type.toLowerCase()) >= 0;
|
||||
},
|
||||
|
||||
exitApp: function() {
|
||||
navigator.app && navigator.app.exitApp && navigator.app.exitApp();
|
||||
},
|
||||
|
||||
showStatusBar: function(val) {
|
||||
// Only useful when run within cordova
|
||||
this.showStatusBar = val;
|
||||
@@ -135,19 +139,26 @@
|
||||
|
||||
};
|
||||
|
||||
var readyCallbacks = [];
|
||||
var platformName;
|
||||
var platformVersion;
|
||||
var platformName,
|
||||
platformVersion,
|
||||
readyCallbacks = [];
|
||||
|
||||
// setup listeners to know when the device is ready to go
|
||||
function onWindowLoad() {
|
||||
// window is loaded, now lets listen for when the device is ready
|
||||
document.addEventListener("deviceready", onCordovaReady, false);
|
||||
if(ionic.Platform.isCordova()) {
|
||||
// the window and scripts are fully loaded, and a cordova/phonegap
|
||||
// object exists then let's listen for the deviceready
|
||||
document.addEventListener("deviceready", onPlatformReady, false);
|
||||
} else {
|
||||
// the window and scripts are fully loaded, but the window object doesn't have the
|
||||
// cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova
|
||||
onPlatformReady();
|
||||
}
|
||||
window.removeEventListener("load", onWindowLoad, false);
|
||||
}
|
||||
window.addEventListener("load", onWindowLoad, false);
|
||||
|
||||
function onCordovaReady() {
|
||||
function onPlatformReady() {
|
||||
// the device is all set to go, init our own stuff then fire off our event
|
||||
ionic.Platform.isReady = true;
|
||||
ionic.Platform.detect();
|
||||
@@ -157,7 +168,7 @@
|
||||
}
|
||||
readyCallbacks = [];
|
||||
ionic.trigger('platformready', { target: document });
|
||||
document.removeEventListener("deviceready", onCordovaReady, false);
|
||||
document.removeEventListener("deviceready", onPlatformReady, false);
|
||||
}
|
||||
|
||||
})(window.ionic);
|
||||
|
||||
Reference in New Issue
Block a user