mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 09:10:09 +00:00
Merge pull request #6584 from julienevano/ionic-utility-platform
ionic framework: static ionic.Platform utility
This commit is contained in:
@@ -102,7 +102,7 @@ class IonicTestController {
|
||||
}
|
||||
private testGesture(): void {
|
||||
var gesture: ionic.gestures.IonicGesture = this.$ionicGesture.on(
|
||||
'eventType',
|
||||
'eventType',
|
||||
(e)=>{ return e; },
|
||||
angular.element("body"),
|
||||
{}
|
||||
@@ -226,7 +226,7 @@ class IonicTestController {
|
||||
cssClass: "cssClass",
|
||||
template: "template",
|
||||
templateUrl: "templateUrl",
|
||||
okText: "OK",
|
||||
okText: "OK",
|
||||
okType: "okType"
|
||||
}).then(() => console.log("popover shown"))
|
||||
this.$ionicPopup.alert({
|
||||
@@ -235,7 +235,7 @@ class IonicTestController {
|
||||
cssClass: "cssClass",
|
||||
template: "template",
|
||||
templateUrl: "templateUrl",
|
||||
okText: "OK",
|
||||
okText: "OK",
|
||||
okType: "okType"
|
||||
}).close();
|
||||
|
||||
@@ -245,9 +245,9 @@ class IonicTestController {
|
||||
cssClass: "cssClass",
|
||||
template: "template",
|
||||
templateUrl: "templateUrl",
|
||||
okText: "OK",
|
||||
okText: "OK",
|
||||
okType: "okType",
|
||||
cancelText: "Cancel",
|
||||
cancelText: "Cancel",
|
||||
cancelType: "cancelType"
|
||||
}).then(() => console.log("popover shown"))
|
||||
this.$ionicPopup.confirm({
|
||||
@@ -256,9 +256,9 @@ class IonicTestController {
|
||||
cssClass: "cssClass",
|
||||
template: "template",
|
||||
templateUrl: "templateUrl",
|
||||
okText: "OK",
|
||||
okText: "OK",
|
||||
okType: "okType",
|
||||
cancelText: "Cancel",
|
||||
cancelText: "Cancel",
|
||||
cancelType: "cancelType"
|
||||
}).close();
|
||||
|
||||
@@ -268,9 +268,9 @@ class IonicTestController {
|
||||
cssClass: "cssClass",
|
||||
template: "template",
|
||||
templateUrl: "templateUrl",
|
||||
okText: "OK",
|
||||
okText: "OK",
|
||||
okType: "okType",
|
||||
cancelText: "Cancel",
|
||||
cancelText: "Cancel",
|
||||
cancelType: "cancelType",
|
||||
inputType: "text",
|
||||
inputPlaceholder: "Type some text..."
|
||||
@@ -281,9 +281,9 @@ class IonicTestController {
|
||||
cssClass: "cssClass",
|
||||
template: "template",
|
||||
templateUrl: "templateUrl",
|
||||
okText: "OK",
|
||||
okText: "OK",
|
||||
okType: "okType",
|
||||
cancelText: "Cancel",
|
||||
cancelText: "Cancel",
|
||||
cancelType: "cancelType",
|
||||
inputType: "text",
|
||||
inputPlaceholder: "Type some text..."
|
||||
@@ -359,6 +359,41 @@ class IonicTestController {
|
||||
var {top: number, left: number, width: number, height: number} = this.$ionicPositionService.position(angular.element("body"));
|
||||
var {top: number, left: number, width: number, height: number} = this.$ionicPositionService.offset(angular.element("body"));
|
||||
}
|
||||
|
||||
/**
|
||||
* ionic.version
|
||||
*/
|
||||
private testStaticVersion(): void {
|
||||
var version: string = ionic.version;
|
||||
}
|
||||
|
||||
/**
|
||||
* ionic.Platform
|
||||
*/
|
||||
private testStaticPlaform(): void {
|
||||
var callbackWithoutReturn: ()=>void;
|
||||
var callbackWithReturn: ()=>boolean;
|
||||
var ready: void = ionic.Platform.ready(callbackWithoutReturn);
|
||||
ready = ionic.Platform.ready(callbackWithReturn);
|
||||
var setGrade: void = ionic.Platform.setGrade('iOS');
|
||||
var deviceInformation: string = ionic.Platform.device();
|
||||
var isWebView: boolean = ionic.Platform.isWebView();
|
||||
var isIPad: boolean = ionic.Platform.isIPad();
|
||||
var isIOS: boolean = ionic.Platform.isIOS();
|
||||
var isAndroid: boolean = ionic.Platform.isAndroid();
|
||||
var isWindowsPhone: boolean = ionic.Platform.isWindowsPhone();
|
||||
var currentPlatform: string = ionic.Platform.platform();
|
||||
var currentPlatformVersion: number = ionic.Platform.version();
|
||||
var exitApp: void = ionic.Platform.exitApp();
|
||||
var showStatusBar: void = ionic.Platform.showStatusBar(true);
|
||||
var showStatusBar: void = ionic.Platform.fullScreen();
|
||||
showStatusBar = ionic.Platform.fullScreen(true);
|
||||
showStatusBar = ionic.Platform.fullScreen(true, true);
|
||||
var isReady: boolean = ionic.Platform.isReady;
|
||||
var isFullScreen: boolean = ionic.Platform.isFullScreen;
|
||||
var platforms: Array<string> = ionic.Platform.platforms;
|
||||
var grade: string = ionic.Platform.grade;
|
||||
}
|
||||
}
|
||||
|
||||
testIonic.controller('ionicTestController', IonicTestController);
|
||||
|
||||
82
ionic/ionic.d.ts
vendored
82
ionic/ionic.d.ts
vendored
@@ -6,7 +6,89 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
interface IonicStatic {
|
||||
/**
|
||||
* What Ionic package version is.
|
||||
*/
|
||||
version: string;
|
||||
Platform: {
|
||||
/**
|
||||
* Trigger a callback once the device is ready, or immediately
|
||||
* if the device is already ready. This method can be run from
|
||||
* anywhere and does not need to be wrapped by any additonal methods.
|
||||
* When the app is within a WebView (Cordova), it’ll fire
|
||||
* the callback once the device is ready. If the app is within
|
||||
* a web browser, it’ll fire the callback after window.load.
|
||||
* Please remember that Cordova features (Camera, FileSystem, etc) still
|
||||
* will not work in a web browser.
|
||||
*/
|
||||
ready(callback: ()=>any): void;
|
||||
/**
|
||||
* Set the grade of the device: ‘a’, ‘b’, or ‘c’. ‘a’ is the best
|
||||
* (most css features enabled), ‘c’ is the worst. By default, sets the grade
|
||||
* depending on the current device.
|
||||
*/
|
||||
setGrade(grade: string): void;
|
||||
/**
|
||||
* Return the current device (given by cordova).
|
||||
*/
|
||||
device(): any;
|
||||
/**
|
||||
* Check if we are running within a WebView (such as Cordova).
|
||||
*/
|
||||
isWebView(): boolean;
|
||||
/**
|
||||
* Whether we are running on iPad.
|
||||
*/
|
||||
isIPad(): boolean;
|
||||
/**
|
||||
* Whether we are running on iOS.
|
||||
*/
|
||||
isIOS(): boolean;
|
||||
/**
|
||||
* Whether we are running on Android.
|
||||
*/
|
||||
isAndroid(): boolean;
|
||||
/**
|
||||
* Whether we are running on Windows Phone.
|
||||
*/
|
||||
isWindowsPhone(): boolean;
|
||||
/**
|
||||
* The name of the current platform.
|
||||
*/
|
||||
platform(): string;
|
||||
/**
|
||||
* The version of the current device platform.
|
||||
*/
|
||||
version(): number;
|
||||
/**
|
||||
* Exit the app.
|
||||
*/
|
||||
exitApp(): void;
|
||||
/**
|
||||
* Shows or hides the device status bar (in Cordova). Requires cordova plugin add org.apache.cordova.statusbar
|
||||
*/
|
||||
showStatusBar(shouldShow: boolean): void;
|
||||
/**
|
||||
* Sets whether the app is fullscreen or not (in Cordova).
|
||||
*/
|
||||
fullScreen(showFullScreen?: boolean, showStatusBar?: boolean): void;
|
||||
/**
|
||||
* Whether the device is ready.
|
||||
*/
|
||||
isReady: boolean;
|
||||
/**
|
||||
* Whether the device is fullscreen.
|
||||
*/
|
||||
isFullScreen: boolean;
|
||||
/**
|
||||
* An array of all platforms found.
|
||||
*/
|
||||
platforms: Array<string>;
|
||||
/**
|
||||
* What grade the current platform is.
|
||||
*/
|
||||
grade: string;
|
||||
};
|
||||
}
|
||||
|
||||
declare var ionic: IonicStatic;
|
||||
|
||||
Reference in New Issue
Block a user