From 7b1ffed4e727e713fec92356ad8ada562485731b Mon Sep 17 00:00:00 2001 From: James Ide Date: Tue, 4 Aug 2015 05:23:31 -0700 Subject: [PATCH] [Async] Enable async/await and update UIExplorer and tests Summary: - Enables async/await in .babelrc and transformer.js - Adds regenerator to package.json. Users still need to explicitly require the regenerator runtime -- this is so that you only pay for what you use. - Update AsyncStorage examples in UIExplorer to use async/await - Update promise tests in UIExplorer to use async/await in addition to the promise API Closes https://github.com/facebook/react-native/pull/1765 Github Author: James Ide --- react-packager/.babelrc | 4 +++- transformer.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/react-packager/.babelrc b/react-packager/.babelrc index c1b12d81..06b8d825 100644 --- a/react-packager/.babelrc +++ b/react-packager/.babelrc @@ -15,10 +15,12 @@ "es6.properties.shorthand", "es6.spread", "es6.templateLiterals", + "es7.asyncFunctions", "es7.trailingFunctionCommas", "es7.objectRestSpread", "flow", - "react" + "react", + "regenerator" ], "sourceMaps": false } diff --git a/transformer.js b/transformer.js index c5b235da..a1da1a02 100644 --- a/transformer.js +++ b/transformer.js @@ -28,10 +28,12 @@ function transform(srcTxt, filename, options) { 'es6.properties.shorthand', 'es6.spread', 'es6.templateLiterals', + 'es7.asyncFunctions', 'es7.trailingFunctionCommas', 'es7.objectRestSpread', 'flow', 'react', + 'regenerator', ], sourceFileName: filename, sourceMaps: false,