Implement asyncEcho in the iOS echo plugin.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/0ac47dbd Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/0ac47dbd Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/0ac47dbd Branch: refs/heads/master Commit: 0ac47dbd3bc49b370508487b7e4f668c6c326f5e Parents: 1a60935 Author: Andrew Grieve <agri...@chromium.org> Authored: Thu Sep 27 09:48:48 2012 -0400 Committer: Andrew Grieve <agri...@chromium.org> Committed: Thu Sep 27 09:48:48 2012 -0400 ---------------------------------------------------------------------- CordovaLib/Classes/CDVEcho.m | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0ac47dbd/CordovaLib/Classes/CDVEcho.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVEcho.m b/CordovaLib/Classes/CDVEcho.m index b8cc7fc..6247dd3 100644 --- a/CordovaLib/Classes/CDVEcho.m +++ b/CordovaLib/Classes/CDVEcho.m @@ -29,4 +29,16 @@ [self success:pluginResult callbackId:command.callbackId]; } +- (void)echoAsyncHelper:(NSArray*)args +{ + [self success:[args objectAtIndex:0] callbackId:[args objectAtIndex:1]]; +} + +- (void)echoAsync:(CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[command.arguments objectAtIndex:0]]; + + [self performSelector:@selector(echoAsyncHelper:) withObject:[NSArray arrayWithObjects:pluginResult, command.callbackId, nil] afterDelay:0]; +} + @end
