From 85f08ab28be59e19e23f85043470c4890d57f44d Mon Sep 17 00:00:00 2001 From: Evan Bacon Date: Thu, 7 Feb 2019 04:08:07 -0800 Subject: [PATCH 1/2] Create Platform.web.js --- Libraries/Utilities/Platform.web.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Libraries/Utilities/Platform.web.js diff --git a/Libraries/Utilities/Platform.web.js b/Libraries/Utilities/Platform.web.js new file mode 100644 index 00000000000000..cd7fa8f28a876a --- /dev/null +++ b/Libraries/Utilities/Platform.web.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +'use strict'; + +const Platform = { + OS: 'web', + select: (obj: Object) => ('web' in obj ? obj.web : obj.default), +}; + +module.exports = Platform; From 11b158cbf33108381ceaca21c24594d0d525cd14 Mon Sep 17 00:00:00 2001 From: Evan Bacon Date: Mon, 11 Feb 2019 16:01:44 -0800 Subject: [PATCH 2/2] Update Platform.web.js --- Libraries/Utilities/Platform.web.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Libraries/Utilities/Platform.web.js b/Libraries/Utilities/Platform.web.js index cd7fa8f28a876a..f70ae14b7d1d2f 100644 --- a/Libraries/Utilities/Platform.web.js +++ b/Libraries/Utilities/Platform.web.js @@ -10,9 +10,15 @@ 'use strict'; +export type PlatformSelectSpec = { + default?: D, + web?: I, +}; + const Platform = { OS: 'web', - select: (obj: Object) => ('web' in obj ? obj.web : obj.default), + select: (spec: PlatformSelectSpec): D | I => + 'web' in spec ? spec.web : spec.default, }; module.exports = Platform;