Skip to content

Commit 853c7f6

Browse files
committed
filter worker-only interfaces
1 parent 361ff2b commit 853c7f6

File tree

4 files changed

+17
-333
lines changed

4 files changed

+17
-333
lines changed

TS.fsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,15 @@ module Data =
283283
/// Check if the given element should be disabled or not
284284
/// reason is that ^a can be an interface, property or method, but they
285285
/// all share a 'tag' property
286-
let inline ShouldKeep flavor (i: ^a when ^a: (member Tags: string option)) =
286+
let inline ShouldKeep flavor (i: ^a when ^a: (member Exposed: string option)) =
287287
let filterByTag =
288-
match (^a: (member Tags: string option) i) with
289-
| Some tags ->
288+
match (^a: (member Exposed: string option) i) with
289+
| Some exposed ->
290+
let exposedArray = exposed.Split [|' '|]
290291
match flavor with
291292
| Flavor.All -> true
292-
| Flavor.Web -> tags <> "MSAppOnly" && tags <> "WinPhoneOnly"
293-
| Flavor.Worker -> tags <> "IEOnly"
293+
| Flavor.Web -> Array.contains "Window" exposedArray
294+
| Flavor.Worker -> true
294295
| _ -> true
295296
filterByTag
296297

@@ -350,7 +351,7 @@ module Data =
350351

351352
let GetCallbackFuncsByFlavor flavor =
352353
browser.CallbackFunctions
353-
|> Array.filter (fun cb -> (flavor <> Flavor.Worker || knownWorkerInterfaces.Contains cb.Name) && ShouldKeep flavor cb)
354+
|> Array.filter (fun cb -> flavor <> Flavor.Worker || knownWorkerInterfaces.Contains cb.Name)
354355

355356
let GetEnumsByFlavor flavor =
356357
match flavor with

0 commit comments

Comments
 (0)