cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject docs commit: CB-2540: Document iOS MultiPart PluginResult
Date Wed, 27 Feb 2013 14:55:25 GMT
Updated Branches:
  refs/heads/master 888deeaac -> 9927fcdf9


CB-2540: Document iOS MultiPart PluginResult


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/9927fcdf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/9927fcdf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/9927fcdf

Branch: refs/heads/master
Commit: 9927fcdf9cdbdfb57233c7b94f3fa664613c5229
Parents: 888deea
Author: Michal Mocny <mmocny@gmail.com>
Authored: Wed Feb 27 09:54:34 2013 -0500
Committer: Michal Mocny <mmocny@gmail.com>
Committed: Wed Feb 27 09:54:34 2013 -0500

----------------------------------------------------------------------
 docs/en/edge/guide/plugin-development/ios/index.md |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9927fcdf/docs/en/edge/guide/plugin-development/ios/index.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/guide/plugin-development/ios/index.md b/docs/en/edge/guide/plugin-development/ios/index.md
index e5bfa88..d536b95 100644
--- a/docs/en/edge/guide/plugin-development/ios/index.md
+++ b/docs/en/edge/guide/plugin-development/ios/index.md
@@ -71,7 +71,20 @@ What gets dispatched to the plugin via JavaScript's `exec` function gets
passed
 2. [CDVPluginResult.h](https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/CDVPluginResult.h)
 3. [CDVCommandDelegate.h](https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/CDVCommandDelegate.h)
 
-  
+## iOS CDVPluginResult message types
+
+Using CDVPluginResult you can return a variety of result types back to your javascript callbacks,
using class methods that look like:
+
+    + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAs...
+
+The types you can create are: `String`, `Int`, `Double`, `Bool`, `Array`, `Dictionary`, `ArrayBuffer`,
and `Multipart`.  Or, don't attach any result (just send a status).  Or, ruturn an Error.
 You can even not send any result at all.
+
+### Notes
+
+ * `messageAsArrayBuffer` expects `NSData*` and will convert to an `ArrayBuffer` for your
javascript callback (and `ArrayBuffers` sent to a plugin from javascript are converted to
`NSData*`).
+ * `messageAsMultipart` expects an `NSArray*` containing any of the other supported types,
and will send the whole array as the `arguments` to your javascript callback.
+   *  Quirk: this is not just syntactic sugar (though it is sweet).  This way, all of the
arguments are serialized/deserialized as necessary.  e.g. it is safe to return `NSData*` as
multipart, but not as `Array`/`Dictionary`.
+
 ## Plugin Signatures
 
 The **new signature** supported beginning in **Cordova 2.1.0** is:


Mime
View raw message