Last active
August 29, 2015 14:25
-
-
Save khadorkin/203dec8a82ae266c5f38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import platform = require("platform"); | |
import application = require("application"); | |
export enum Length { | |
Short = 2000, | |
Long = 3500 | |
} | |
export function show(message: string, length: Length = Length.Long) { | |
if (platform.device.os === platform.platformNames.android) { | |
android.widget.Toast.makeText(application.android.context, message, length).show(); | |
} else if (platform.device.os === platform.platformNames.ios) { | |
var toast = new UIAlertView(null, message, null, null, null); | |
toast.show(); | |
setTimeout(() => { | |
toast.dismissWithClickedButtonIndexAnimated(0, true); | |
}, length); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment