react-native/React
James Ide d548c85da6 [Bridge] Add support for JS async functions to RCT_EXPORT_METHOD
Summary:
Adds support for JS async methods and helps guide people writing native modules w.r.t. the callbacks. With this diff, on the native side you write:

```objc
RCT_EXPORT_METHOD(getValueAsync:(NSString *)key
                       resolver:(RCTPromiseResolver)resolve
                       rejecter:(RCTPromiseRejecter)reject)
{
  NSError *error = nil;
  id value = [_nativeDataStore valueForKey:key error:&error];

  // "resolve" and "reject" are automatically defined blocks that take
  // any object (nil is OK) and an NSError, respectively
  if (!error) {
    resolve(value);
  } else {
    reject(error);
  }
}
```

On the JS side, you can write:

```js
var {DemoDataStore} = require('react-native').NativeModules;
DemoDataStore.getValueAsync('sample-key').then((value) => {
  console.log('Got:', value);
}, (error) => {
  console.error(error);
  // "error" is an Error object whose message is the NSError's description.
  // The NSError's code and domain are also set, and the native trace i
Closes https://github.com/facebook/react-native/pull/1232
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-01 10:50:06 -08:00
..
Base [Bridge] Add support for JS async functions to RCT_EXPORT_METHOD 2015-06-01 10:50:06 -08:00
Executors [ReactNative] Use JSValueIsUndefined instead of comparing with JSValueMakeUndefined 2015-05-30 13:32:11 -08:00
Layout Fixed layout bug 2015-05-13 13:24:36 -07:00
Modules Fixed text update on OSS 2015-06-01 08:44:11 -08:00
React.xcodeproj Implemented fast path for same borders/radii 2015-05-28 09:16:44 -08:00
Views Fixed text update on OSS 2015-06-01 08:44:11 -08:00