mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2026-07-31 00:02:14 +08:00
#4 Upgrading the JS API to prepare for custom options (no additional options yet, this is a change to make that possible in the future)
This commit is contained in:
+5
-3
@@ -6,9 +6,11 @@
|
||||
|
||||
- (void)show:(CDVInvokedUrlCommand*)command {
|
||||
|
||||
NSString *message = [command.arguments objectAtIndex:0];
|
||||
NSString *duration = [command.arguments objectAtIndex:1];
|
||||
NSString *position = [command.arguments objectAtIndex:2];
|
||||
NSDictionary* options = [command.arguments objectAtIndex:0];
|
||||
|
||||
NSString *message = [options objectForKey:@"message"];
|
||||
NSString *duration = [options objectForKey:@"duration"];
|
||||
NSString *position = [options objectForKey:@"position"];
|
||||
|
||||
if (![position isEqual: @"top"] && ![position isEqual: @"center"] && ![position isEqual: @"bottom"]) {
|
||||
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"invalid position. valid options are 'top', 'center' and 'bottom'"];
|
||||
|
||||
Reference in New Issue
Block a user