Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions src/core/BaseFile.res

This file was deleted.

23 changes: 22 additions & 1 deletion src/core/DOM.res
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,29 @@ type predefinedColorSpace =
| @as("display-p3") DisplayP3
| @as("srgb") Srgb

/**
A file-like object of immutable, raw data.
[See Blob on MDN](https://developer.mozilla.org/docs/Web/API/Blob)
*/
type blob = private {
size: int,
@as("type")
type_: string,
}

/**
Provides information about a file selected by or available to the user.
[See File on MDN](https://developer.mozilla.org/docs/Web/API/File)
*/
type file = private {
...blob,
name: string,
lastModified: int,
webkitRelativePath: string,
}

type shareData = {
mutable files?: array<BaseFile.file>,
mutable files?: array<file>,
mutable title?: string,
mutable text?: string,
mutable url?: string,
Expand Down
4 changes: 2 additions & 2 deletions src/file/FileTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A file-like object of immutable, raw data. Blobs represent data that isn't neces
[See Blob on MDN](https://developer.mozilla.org/docs/Web/API/Blob)
*/
@editor.completeFrom(Blob)
type blob = BaseFile.blob = private {
type blob = DOM.blob = private {
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Blob/size)
*/
Expand Down Expand Up @@ -71,7 +71,7 @@ Provides information about files and allows JavaScript in a web page to access t
[See WebApiFile on MDN](https://developer.mozilla.org/docs/Web/API/File)
*/
@editor.completeFrom(WebApiFile)
type file = BaseFile.file = private {
type file = DOM.file = private {
...blob,
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/File/name)
Expand Down
42 changes: 21 additions & 21 deletions src/storage/Cache.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,65 @@
*/
@send
external match: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: FetchTypes.request,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => Nullable.t<FetchTypes.response> = "match"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/match)
*/
@send
external match2: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: string,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => Nullable.t<FetchTypes.response> = "match"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/matchAll)
*/
@send
external matchAll: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: FetchTypes.request=?,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => promise<array<FetchTypes.response>> = "matchAll"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/matchAll)
*/
@send
external matchAll2: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: string=?,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => promise<array<FetchTypes.response>> = "matchAll"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/add)
*/
@send
external add: (WebWorkersTypes.cache, FetchTypes.request) => promise<unit> = "add"
external add: (CacheTypes.cache, FetchTypes.request) => promise<unit> = "add"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/add)
*/
@send
external add2: (WebWorkersTypes.cache, string) => promise<unit> = "add"
external add2: (CacheTypes.cache, string) => promise<unit> = "add"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/addAll)
*/
@send
external addAll: (WebWorkersTypes.cache, array<FetchTypes.requestInfo>) => promise<unit> = "addAll"
external addAll: (CacheTypes.cache, array<FetchTypes.requestInfo>) => promise<unit> = "addAll"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/put)
*/
@send
external put: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: FetchTypes.request,
~response: FetchTypes.response,
) => promise<unit> = "put"
Expand All @@ -71,7 +71,7 @@ external put: (
*/
@send
external put2: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: string,
~response: FetchTypes.response,
) => promise<unit> = "put"
Expand All @@ -81,37 +81,37 @@ external put2: (
*/
@send
external delete: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: FetchTypes.request,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => promise<bool> = "delete"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/delete)
*/
@send
external delete2: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: string,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => promise<bool> = "delete"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/keys)
*/
@send
external keys: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: FetchTypes.request=?,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => promise<array<FetchTypes.request>> = "keys"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Cache/keys)
*/
@send
external keys2: (
WebWorkersTypes.cache,
CacheTypes.cache,
~request: string=?,
~options: WebWorkersTypes.cacheQueryOptions=?,
~options: CacheTypes.cacheQueryOptions=?,
) => promise<array<FetchTypes.request>> = "keys"
16 changes: 8 additions & 8 deletions src/storage/CacheStorage.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,41 @@
*/
@send
external match: (
WebWorkersTypes.cacheStorage,
CacheTypes.cacheStorage,
~request: FetchTypes.request,
~options: WebWorkersTypes.multiCacheQueryOptions=?,
~options: CacheTypes.multiCacheQueryOptions=?,
) => Nullable.t<FetchTypes.response> = "match"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage/match)
*/
@send
external match2: (
WebWorkersTypes.cacheStorage,
CacheTypes.cacheStorage,
~request: string,
~options: WebWorkersTypes.multiCacheQueryOptions=?,
~options: CacheTypes.multiCacheQueryOptions=?,
) => Nullable.t<FetchTypes.response> = "match"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage/has)
*/
@send
external has: (WebWorkersTypes.cacheStorage, string) => promise<bool> = "has"
external has: (CacheTypes.cacheStorage, string) => promise<bool> = "has"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
*/
@send
external open_: (WebWorkersTypes.cacheStorage, string) => promise<WebWorkersTypes.cache> = "open"
external open_: (CacheTypes.cacheStorage, string) => promise<CacheTypes.cache> = "open"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage/delete)
*/
@send
external delete: (WebWorkersTypes.cacheStorage, string) => promise<bool> = "delete"
external delete: (CacheTypes.cacheStorage, string) => promise<bool> = "delete"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage/keys)
*/
@send
external keys: WebWorkersTypes.cacheStorage => promise<array<string>> = "keys"
external keys: CacheTypes.cacheStorage => promise<array<string>> = "keys"
24 changes: 24 additions & 0 deletions src/storage/CacheTypes.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the Service Worker life cycle. The Cache interface is also available in window contexts.
[See Cache on MDN](https://developer.mozilla.org/docs/Web/API/Cache)
*/
@editor.completeFrom(Cache)
type cache = private {}

/**
The storage for Cache objects.
[See CacheStorage on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage)
*/
@editor.completeFrom(CacheStorage)
type cacheStorage = private {}

type cacheQueryOptions = {
mutable ignoreSearch?: bool,
mutable ignoreMethod?: bool,
mutable ignoreVary?: bool,
}

type multiCacheQueryOptions = {
...cacheQueryOptions,
mutable cacheName?: string,
}
2 changes: 1 addition & 1 deletion src/window/DomGlobal.res
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ external performance: PerformanceTypes.performance = "performance"
/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/caches)
*/
external caches: WebWorkersTypes.cacheStorage = "caches"
external caches: CacheTypes.cacheStorage = "caches"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/sessionStorage)
Expand Down
2 changes: 1 addition & 1 deletion src/window/Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ external performance: t => PerformanceTypes.performance = "performance"
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/caches)
*/
@get
external caches: t => WebWorkersTypes.cacheStorage = "caches"
external caches: t => CacheTypes.cacheStorage = "caches"

/**
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Window/sessionStorage)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/**
Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the WebApiServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
[See Cache on MDN](https://developer.mozilla.org/docs/Web/API/Cache)
*/
@editor.completeFrom(Cache)
type cache = private {}

/**
The storage for Cache objects.
[See CacheStorage on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage)
*/
@editor.completeFrom(CacheStorage)
type cacheStorage = private {}

type cacheQueryOptions = {
mutable ignoreSearch?: bool,
mutable ignoreMethod?: bool,
mutable ignoreVary?: bool,
}

type multiCacheQueryOptions = {
...cacheQueryOptions,
mutable cacheName?: string,
}

type sharedWorker

/**
Expand All @@ -38,7 +13,7 @@ type workerGlobalScope = private {
/**
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/caches)
*/
caches: cacheStorage,
caches: CacheTypes.cacheStorage,
/**
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/crossOriginIsolated)
*/
Expand Down
Loading