Skip to content

Commit c2fdea0

Browse files
committed
0.4.2
1 parent 8bbd9cf commit c2fdea0

13 files changed

Lines changed: 109 additions & 31 deletions

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ The type declarations in this repository include the following specifications (g
123123
- [WebCodecs](https://w3c.github.io/webcodecs/)
124124
- [Window Management](https://w3c.github.io/window-management/)
125125
- [Web Hypertext Application Technology Working Group (WHATWG)](https://spec.whatwg.org):
126+
- [File System Observer](https://github.com/whatwg/fs/blob/main/proposals/FileSystemObserver.md)
126127
- [File System](https://fs.spec.whatwg.org)
127128
- [HTML](https://html.spec.whatwg.org/multipage/)
128129
- [Web Bluetooth Community Group](https://webbluetoothcg.github.io):
@@ -135,4 +136,4 @@ The type declarations in this repository include the following specifications (g
135136
- [Global Privacy Control](https://privacycg.github.io/gpc-spec/)
136137
- [TC39](https://tc39.es):
137138
- [Array.fromAsync](https://tc39.es/proposal-array-from-async/)
138-
- [ECMAScript Language Specification](https://tc39.es/ecma262/)
139+
- [ECMAScript](https://tc39.es/ecma262/)

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
/// <reference path="./webbluetoothcg/bluetooth.d.ts" />
4848

49+
/// <reference path="./whatwg/file-system-observer.d.ts" />
4950
/// <reference path="./whatwg/file-system.d.ts" />
5051
/// <reference path="./whatwg/html.d.ts" />
5152

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "new-javascript",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "TypeScript type definitions for new JavaScript stuff that isn't yet in TypeScript's standard type definitions",
55
"main": "./index.d.ts",
66
"repository": {

tc39/esnext.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
// ECMAScript Language Specification
2+
// ECMAScript
33
// Specification: https://tc39.es/ecma262/multipage/
44
// Repository: https://github.com/tc39/ecma262
55

test.ts

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// import css from "sdlkfjasdf.css" assert { type: "css" };
33

44
// / <reference no-default-lib="true" />
5-
// / <reference lib="ESNext" />
6-
// / <reference lib="DOM" />
7-
// / <reference lib="DOM.Iterable" />
5+
/// <reference lib="ESNext" />
6+
/// <reference lib="DOM" />
7+
/// <reference lib="DOM.Iterable" />
88
// / <reference path="./worker.d.ts" />
99
/// <reference path="./index.d.ts" />
1010
// / <reference path="./worklet/paint.d.ts" />
@@ -19,8 +19,20 @@ Promise.allSettled
1919

2020
ArrayBuffer.prototype
2121

22+
const observer = new FileSystemObserver((changes) => {
23+
24+
})
25+
26+
observer.observe
27+
2228
SharedArrayBuffer.prototype
2329

30+
// import("./package.json", {
31+
// with: {
32+
// type: "json"
33+
// }
34+
// })
35+
2436
let buffer = new ArrayBuffer(5)
2537
buffer.resize(10)
2638

@@ -31,10 +43,10 @@ sab.growable && sab.grow(20)
3143
"".toWellFormed()
3244
"".isWellFormed()
3345

34-
;[].toReversed
35-
;[].toSorted
36-
;[].toSpliced
37-
;[].with
46+
;[].toReversed
47+
;[].toSorted
48+
;[].toSpliced
49+
;[].with
3850
Uint8Array.prototype.toReversed
3951
Uint8Array.prototype.toSorted
4052
Uint8Array.prototype.with
@@ -43,6 +55,15 @@ new Promise<void>((res, rej) => {
4355
res()
4456
})
4557

58+
navigator.permissions.query({ name: "geolocation" })
59+
navigator.permissions.query({ name: "web-share" })
60+
navigator.permissions.request({ name: "geolocation" })
61+
navigator.permissions.request({ name: "web-share" })
62+
navigator.permissions.requestAll([{ name: "geolocation" }])
63+
navigator.permissions.requestAll([{ name: "web-share" }])
64+
navigator.permissions.revoke({ name: "geolocation" })
65+
navigator.permissions.revoke({ name: "web-share" })
66+
4667
let { promise, resolve, reject } = Promise.withResolvers();
4768
{
4869
let { promise, resolve, reject } = Promise.withResolvers<number>();

tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"module": "ESNext",
4+
"target": "ESNext",
5+
"noEmit": true,
6+
"strict": false,
7+
"lib": ["ESNext", "DOM", "DOM.Iterable"],
8+
"types": [],
9+
},
10+
}

w3c/permissions-registry.d.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@
55

66
declare namespace NewJavaScript {
77
type PermissionName = (
8-
// in lib.dom.d.ts:
9-
| "geolocation"
10-
| "notifications"
11-
| "push"
12-
| "persistent-storage"
13-
| "screen-wake-lock"
14-
| "xr-spatial-tracking"
8+
// already in lib.dom.d.ts: "geolocation", "notifications", "persistent-storage", "push", "screen-wake-lock", "xr-spatial-tracking"
159

1610
// https://w3c.github.io/permissions-registry/#registry-table-of-standardized-permissions:
1711
| "web-share"
@@ -30,8 +24,10 @@ declare namespace NewJavaScript {
3024
| "ambient-light-sensor"
3125
| "gyroscope"
3226
| "magnetometer"
27+
| "screen-wake-lock"
3328
| "nfc"
3429
| "display-capture"
30+
3531
| "accessibility-events"
3632
| "clipboard-read"
3733
| "clipboard-write"
@@ -40,8 +36,10 @@ declare namespace NewJavaScript {
4036
| "periodic-background-sync"
4137
| "system-wake-lock"
4238
| "storage-access"
39+
| "window-management"
4340
| "window-placement"
4441
| "top-level-storage-access"
42+
| "captured-surface-control"
4543
);
4644

4745
interface PermissionDescriptor {

whatwg/file-system-observer.d.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
// File System Observer
3+
// Explainer: https://github.com/whatwg/fs/blob/main/proposals/FileSystemObserver.md
4+
5+
interface FileSystemObserver {
6+
observe(handle: FileSystemHandle, options?: FileSystemObserverObserveOptions): Promise<void>;
7+
unobserve(handle: FileSystemHandle): void;
8+
disconnect(): void;
9+
}
10+
11+
declare var FileSystemObserver: {
12+
prototype: FileSystemObserver;
13+
new(callback: FileSystemObserverCallback): FileSystemObserver;
14+
};
15+
16+
type FileSystemObserverCallback = (records: FileSystemChangeRecord[], observer: FileSystemObserver) => void;
17+
18+
type FileSystemChangeType = (
19+
| "created"
20+
| "deleted"
21+
| "modified"
22+
| "moved"
23+
| "unsupported"
24+
| "errored"
25+
);
26+
27+
interface FileSystemObserverObserveOptions {
28+
recursive?: boolean;
29+
}
30+
31+
interface FileSystemChangeRecord {
32+
readonly root: FileSystemHandle;
33+
readonly changedHandle: FileSystemHandle;
34+
readonly relativePathComponents: ReadonlyArray<string>;
35+
readonly type: FileSystemChangeType;
36+
readonly relativePathMovedFrom: FileSystemHandle | null;
37+
}

whatwg/file-system.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
// Repository: https://github.com/whatwg/fs
55

66
interface FileSystemHandle {
7-
// non-standard getUniqueId() function (Chromium only, see https://github.com/whatwg/fs/blob/97bcadc/UniqueID.md):
7+
// non-standard getUniqueId() function (Chromium only, see https://github.com/whatwg/fs/blob/9063e17/UniqueID.md):
88
getUniqueId(): Promise<string>;
99
}
1010

1111
interface FileSystemFileHandle extends FileSystemHandle {
1212
// non-standard move() function (Chromium only, see https://whatpr.org/fs/10.html#dom-filesystemhandle-move):
13-
move(name: string): Promise<void>;
14-
move(parent: FileSystemDirectoryHandle): Promise<void>;
15-
move(parent: FileSystemDirectoryHandle, name: string): Promise<void>;
13+
move(newEntryName: string): Promise<void>;
14+
move(destinationDirectory: FileSystemDirectoryHandle): Promise<void>;
15+
move(destinationDirectory: FileSystemDirectoryHandle, newEntryName: string): Promise<void>;
1616
}
1717

1818
interface FileSystemDirectoryHandle extends FileSystemHandle {

wicg/permissions-request.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
/// <reference path="../w3c/permissions-registry.d.ts" />
77

88
interface Permissions {
9-
request(permissionDesc: NewJavaScript.PermissionDescriptor): Promise<PermissionStatus>;
9+
request(permissionDesc: PermissionDescriptor | NewJavaScript.PermissionDescriptor): Promise<PermissionStatus>;
1010

1111
// non-standard requestAll() function (https://crbug.com/516626):
12-
requestAll(permissionsDesc: NewJavaScript.PermissionDescriptor[]): Promise<PermissionStatus>;
12+
requestAll(permissionsDesc: (PermissionDescriptor | NewJavaScript.PermissionDescriptor)[]): Promise<PermissionStatus>;
1313
}

0 commit comments

Comments
 (0)