mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
openUrl added
This commit is contained in:
@ -131,3 +131,10 @@ export module ad {
|
|||||||
export function GC() {
|
export function GC() {
|
||||||
gc();
|
gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function openUrl(url: string): void {
|
||||||
|
var context = ad.getApplicationContext();
|
||||||
|
if (context) {
|
||||||
|
context.startActivity(new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(url)));
|
||||||
|
}
|
||||||
|
}
|
6
utils/utils.d.ts
vendored
6
utils/utils.d.ts
vendored
@ -173,4 +173,10 @@
|
|||||||
* @param source The JSON or JSONP string.
|
* @param source The JSON or JSONP string.
|
||||||
*/
|
*/
|
||||||
export function parseJSON(source: string): any
|
export function parseJSON(source: string): any
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens url.
|
||||||
|
* @param url The url.
|
||||||
|
*/
|
||||||
|
export function openUrl(url: string): void
|
||||||
}
|
}
|
||||||
|
@ -147,3 +147,10 @@ export module ios {
|
|||||||
export function GC() {
|
export function GC() {
|
||||||
__collect();
|
__collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function openUrl(url: string): void {
|
||||||
|
var sharedApp = UIApplication.sharedApplication()
|
||||||
|
if (sharedApp) {
|
||||||
|
sharedApp.openURL(NSURL.URLWithString(url));
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user