Skip to content

Commit 10c62e4

Browse files
cknittMoOx
authored andcommitted
Remove PromiseUtils in the spirit of zero cost. (#376)
1 parent 8b4e2eb commit 10c62e4

6 files changed

Lines changed: 2 additions & 53 deletions

File tree

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
'use strict';
2-
3-
var ReactNative = require("react-native");
4-
var PromiseUtils$ReactNative = require("../utils/PromiseUtils.bs.js");
5-
6-
function getItem(key) {
7-
return ReactNative.AsyncStorage.getItem(key).then(PromiseUtils$ReactNative.nullableToOption);
8-
}
9-
10-
function getAllKeys(param) {
11-
return ReactNative.AsyncStorage.getAllKeys().then(PromiseUtils$ReactNative.nullableToOption);
12-
}
13-
14-
function multiGet(keys) {
15-
return ReactNative.AsyncStorage.multiGet(keys).then(PromiseUtils$ReactNative.nullableToOption);
16-
}
17-
18-
exports.getItem = getItem;
19-
exports.getAllKeys = getAllKeys;
20-
exports.multiGet = multiGet;
21-
/* react-native Not a pure module */
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

‎bs-react-native-next/src/apis/AsyncStorage.re‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ type error;
22

33
[@bs.scope "AsyncStorage"] [@bs.module "react-native"]
44
external getItem: string => Js.Promise.t(Js.Null.t(string)) = "getItem";
5-
let getItem = key =>
6-
getItem(key) |> Js.Promise.then_(PromiseUtils.nullableToOption);
75

86
[@bs.scope "AsyncStorage"] [@bs.module "react-native"]
97
external setItem: (string, string) => Js.Promise.t(unit) = "setItem";
@@ -20,8 +18,6 @@ external clear: unit => Js.Promise.t(unit) = "clear";
2018
[@bs.scope "AsyncStorage"] [@bs.module "react-native"]
2119
external getAllKeys: unit => Js.Promise.t(Js.Null.t(array(string))) =
2220
"getAllKeys";
23-
let getAllKeys = () =>
24-
getAllKeys() |> Js.Promise.then_(PromiseUtils.nullableToOption);
2521

2622
[@bs.scope "AsyncStorage"] [@bs.module "react-native"]
2723
external flushGetRequests: unit => unit = "";
@@ -30,8 +26,6 @@ external flushGetRequests: unit => unit = "";
3026
external multiGet:
3127
array(string) => Js.Promise.t(Js.Null.t(array(array(string)))) =
3228
"multiGet";
33-
let multiGet = keys =>
34-
multiGet(keys) |> Js.Promise.then_(PromiseUtils.nullableToOption);
3529

3630
[@bs.scope "AsyncStorage"] [@bs.module "react-native"]
3731
external multiSet: array((string, string)) => Js.Promise.t(unit) =
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
'use strict';
2-
3-
var ReactNative = require("react-native");
4-
var PromiseUtils$ReactNative = require("../utils/PromiseUtils.bs.js");
5-
6-
function getInitialURL(param) {
7-
return ReactNative.Linking.getInitialURL().then(PromiseUtils$ReactNative.nullableToOption);
8-
}
9-
10-
exports.getInitialURL = getInitialURL;
11-
/* react-native Not a pure module */
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

‎bs-react-native-next/src/apis/Linking.re‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ external canOpenURL: string => Js.Promise.t(bool) = "canOpenURL";
88
external getInitialURL: unit => Js.Promise.t(Js.Null.t(string)) =
99
"getInitialURL";
1010

11-
let getInitialURL = () =>
12-
Js.Promise.(getInitialURL() |> then_(PromiseUtils.nullableToOption));
13-
1411
[@bs.scope "Linking"] [@bs.module "react-native"]
1512
external addEventListener: (string, {. "url": string} => unit) => unit = "";
1613

‎bs-react-native-next/src/utils/PromiseUtils.bs.js‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎bs-react-native-next/src/utils/PromiseUtils.re‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)