@nx.js/runtime 0.0.65 → 0.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +562 -366
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -587,6 +587,24 @@ declare class Path2D {
|
|
|
587
587
|
rect(x: number, y: number, width: number, height: number): void;
|
|
588
588
|
roundRect(x: number, y: number, width: number, height: number, radii?: number | number[]): void;
|
|
589
589
|
}
|
|
590
|
+
declare class CanvasGradient {
|
|
591
|
+
/**
|
|
592
|
+
* @ignore
|
|
593
|
+
*/
|
|
594
|
+
constructor();
|
|
595
|
+
/**
|
|
596
|
+
* Adds a new color stop, defined by an offset and a color, to a given canvas gradient.
|
|
597
|
+
*
|
|
598
|
+
* @param offset A number between `0` and `1`, inclusive, representing the position of the color stop. `0` represents the start of the gradient and `1` represents the end.
|
|
599
|
+
* @param color A CSS color string representing the color of the stop.
|
|
600
|
+
* @see https://developer.mozilla.org/docs/Web/API/CanvasGradient/addColorStop
|
|
601
|
+
*/
|
|
602
|
+
addColorStop(offset: number, color: string): void;
|
|
603
|
+
/**
|
|
604
|
+
* @internal
|
|
605
|
+
*/
|
|
606
|
+
get _opaque(): any;
|
|
607
|
+
}
|
|
590
608
|
declare class CanvasRenderingContext2D {
|
|
591
609
|
/**
|
|
592
610
|
* @ignore
|
|
@@ -632,16 +650,16 @@ declare class CanvasRenderingContext2D {
|
|
|
632
650
|
* @default "#000" (black)
|
|
633
651
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle
|
|
634
652
|
*/
|
|
635
|
-
get fillStyle(): string;
|
|
636
|
-
set fillStyle(v: string);
|
|
653
|
+
get fillStyle(): string | CanvasGradient;
|
|
654
|
+
set fillStyle(v: string | CanvasGradient);
|
|
637
655
|
/**
|
|
638
656
|
* Specifies the color, gradient, or pattern to use for the strokes (outlines) around shapes.
|
|
639
657
|
*
|
|
640
658
|
* @default "#000" (black)
|
|
641
659
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle
|
|
642
660
|
*/
|
|
643
|
-
get strokeStyle(): string;
|
|
644
|
-
set strokeStyle(v: string);
|
|
661
|
+
get strokeStyle(): string | CanvasGradient;
|
|
662
|
+
set strokeStyle(v: string | CanvasGradient);
|
|
645
663
|
/**
|
|
646
664
|
* Specifies the alpha (transparency) value that is applied to shapes and images
|
|
647
665
|
* before they are drawn onto the canvas.
|
|
@@ -1234,16 +1252,16 @@ declare class OffscreenCanvasRenderingContext2D {
|
|
|
1234
1252
|
* @default "#000" (black)
|
|
1235
1253
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle
|
|
1236
1254
|
*/
|
|
1237
|
-
get fillStyle(): string;
|
|
1238
|
-
set fillStyle(v: string);
|
|
1255
|
+
get fillStyle(): string | CanvasGradient;
|
|
1256
|
+
set fillStyle(v: string | CanvasGradient);
|
|
1239
1257
|
/**
|
|
1240
1258
|
* Specifies the color, gradient, or pattern to use for the strokes (outlines) around shapes.
|
|
1241
1259
|
*
|
|
1242
1260
|
* @default "#000" (black)
|
|
1243
1261
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle
|
|
1244
1262
|
*/
|
|
1245
|
-
get strokeStyle(): string;
|
|
1246
|
-
set strokeStyle(v: string);
|
|
1263
|
+
get strokeStyle(): string | CanvasGradient;
|
|
1264
|
+
set strokeStyle(v: string | CanvasGradient);
|
|
1247
1265
|
/**
|
|
1248
1266
|
* Specifies the alpha (transparency) value that is applied to shapes and images
|
|
1249
1267
|
* before they are drawn onto the canvas.
|
|
@@ -2797,7 +2815,7 @@ declare class SubtleCrypto {
|
|
|
2797
2815
|
exportKey(format: "pkcs8" | "raw" | "spki", key: CryptoKey<never>): Promise<ArrayBuffer>;
|
|
2798
2816
|
generateKey(algorithm: "Ed25519", extractable: boolean, keyUsages: readonly ("sign" | "verify")[]): Promise<CryptoKeyPair<never>>;
|
|
2799
2817
|
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKeyPair<never>>;
|
|
2800
|
-
generateKey(algorithm: AesKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2818
|
+
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2801
2819
|
/**
|
|
2802
2820
|
* Takes as input a key in an external, portable format and returns a
|
|
2803
2821
|
* {@link CryptoKey | `CryptoKey`} instance which can be used in the Web Crypto API.
|
|
@@ -2806,6 +2824,7 @@ declare class SubtleCrypto {
|
|
|
2806
2824
|
*/
|
|
2807
2825
|
importKey<Cipher extends KeyAlgorithmIdentifier>(format: "jwk", keyData: JsonWebKey, algorithm: Cipher | KeyImportParams<Cipher>, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<Cipher>>;
|
|
2808
2826
|
importKey<Cipher extends KeyAlgorithmIdentifier>(format: "pkcs8" | "raw" | "spki", keyData: BufferSource, algorithm: Cipher | KeyImportParams<Cipher>, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<Cipher>>;
|
|
2827
|
+
importKey(format: KeyFormat, keyData: BufferSource | JsonWebKey, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2809
2828
|
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey<never>, data: BufferSource): Promise<ArrayBuffer>;
|
|
2810
2829
|
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey<never>, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2811
2830
|
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey<never>, signature: BufferSource, data: BufferSource): Promise<boolean>;
|
|
@@ -2819,14 +2838,14 @@ declare class Console {
|
|
|
2819
2838
|
constructor(opts?: ConsoleOptions);
|
|
2820
2839
|
/**
|
|
2821
2840
|
* Prints string `s` to the console on the screen, without any formatting applied.
|
|
2822
|
-
*
|
|
2841
|
+
* A newline is _not_ appended to the end of the string.
|
|
2823
2842
|
*
|
|
2824
2843
|
* @param s The text to print to the console.
|
|
2825
2844
|
*/
|
|
2826
2845
|
print: (s: string) => void;
|
|
2827
2846
|
/**
|
|
2828
2847
|
* Prints string `s` to the debug log file, without any formatting applied.
|
|
2829
|
-
*
|
|
2848
|
+
* A newline is _not_ appended to the end of the string.
|
|
2830
2849
|
*
|
|
2831
2850
|
* > TIP: This function **does not** invoke _text rendering mode_, so it can safely be used when rendering with the Canvas API.
|
|
2832
2851
|
*
|
|
@@ -3380,6 +3399,61 @@ declare class Storage {
|
|
|
3380
3399
|
* @see https://developer.mozilla.org/docs/Web/API/Window/localStorage
|
|
3381
3400
|
*/
|
|
3382
3401
|
declare var localStorage: Storage | undefined;
|
|
3402
|
+
/**
|
|
3403
|
+
* The `Audio` class provides audio playback functionality similar to the
|
|
3404
|
+
* [`HTMLAudioElement`](https://developer.mozilla.org/docs/Web/API/HTMLAudioElement)
|
|
3405
|
+
* in web browsers.
|
|
3406
|
+
*
|
|
3407
|
+
* ### Supported Audio Formats
|
|
3408
|
+
*
|
|
3409
|
+
* - `mp3` — MP3 audio using [dr_mp3](https://github.com/mackron/dr_libs)
|
|
3410
|
+
* - `wav` — WAV audio using [dr_wav](https://github.com/mackron/dr_libs)
|
|
3411
|
+
* - `ogg` — OGG Vorbis audio using [stb_vorbis](https://github.com/nothings/stb)
|
|
3412
|
+
*
|
|
3413
|
+
* @example
|
|
3414
|
+
*
|
|
3415
|
+
* ```typescript
|
|
3416
|
+
* const audio = new Audio('romfs:/music.mp3');
|
|
3417
|
+
* audio.addEventListener('canplaythrough', () => {
|
|
3418
|
+
* audio.play();
|
|
3419
|
+
* });
|
|
3420
|
+
* ```
|
|
3421
|
+
*/
|
|
3422
|
+
declare class Audio extends EventTarget {
|
|
3423
|
+
#private;
|
|
3424
|
+
onplay: ((this: Audio, ev: Event) => any) | null;
|
|
3425
|
+
onpause: ((this: Audio, ev: Event) => any) | null;
|
|
3426
|
+
onended: ((this: Audio, ev: Event) => any) | null;
|
|
3427
|
+
onerror: ((this: Audio, ev: ErrorEvent) => any) | null;
|
|
3428
|
+
oncanplaythrough: ((this: Audio, ev: Event) => any) | null;
|
|
3429
|
+
onloadedmetadata: ((this: Audio, ev: Event) => any) | null;
|
|
3430
|
+
ontimeupdate: ((this: Audio, ev: Event) => any) | null;
|
|
3431
|
+
constructor(src?: string);
|
|
3432
|
+
get src(): string;
|
|
3433
|
+
set src(val: string);
|
|
3434
|
+
get currentSrc(): string;
|
|
3435
|
+
get volume(): number;
|
|
3436
|
+
set volume(val: number);
|
|
3437
|
+
get loop(): boolean;
|
|
3438
|
+
set loop(val: boolean);
|
|
3439
|
+
get paused(): boolean;
|
|
3440
|
+
get ended(): boolean;
|
|
3441
|
+
get currentTime(): number;
|
|
3442
|
+
set currentTime(val: number);
|
|
3443
|
+
get duration(): number;
|
|
3444
|
+
get playbackRate(): number;
|
|
3445
|
+
set playbackRate(val: number);
|
|
3446
|
+
get readyState(): number;
|
|
3447
|
+
static get HAVE_NOTHING(): number;
|
|
3448
|
+
static get HAVE_METADATA(): number;
|
|
3449
|
+
static get HAVE_CURRENT_DATA(): number;
|
|
3450
|
+
static get HAVE_FUTURE_DATA(): number;
|
|
3451
|
+
static get HAVE_ENOUGH_DATA(): number;
|
|
3452
|
+
load(): void;
|
|
3453
|
+
play(): Promise<void>;
|
|
3454
|
+
pause(): void;
|
|
3455
|
+
dispatchEvent(event: Event): boolean;
|
|
3456
|
+
}
|
|
3383
3457
|
/**
|
|
3384
3458
|
* The `Window` class represents the global scope within the application.
|
|
3385
3459
|
*
|
|
@@ -3619,21 +3693,6 @@ declare function queueMicrotask(callback: () => void): void;
|
|
|
3619
3693
|
* The `Switch` global object contains native interfaces to interact with the Switch hardware.
|
|
3620
3694
|
*/
|
|
3621
3695
|
declare namespace Switch {
|
|
3622
|
-
/**
|
|
3623
|
-
* A Map-like object providing methods to interact with the environment variables of the process.
|
|
3624
|
-
*
|
|
3625
|
-
* Use {@link env | `Switch.env`} to access the singleton instance of this class.
|
|
3626
|
-
*/
|
|
3627
|
-
declare class Env {
|
|
3628
|
-
/**
|
|
3629
|
-
* @private
|
|
3630
|
-
*/
|
|
3631
|
-
constructor();
|
|
3632
|
-
get(name: string): string | undefined;
|
|
3633
|
-
set(name: string, value: string): void;
|
|
3634
|
-
delete(name: string): void;
|
|
3635
|
-
toObject(): Record<string, string>;
|
|
3636
|
-
}
|
|
3637
3696
|
/**
|
|
3638
3697
|
* The `Socket` class represents a TCP connection, from which you can
|
|
3639
3698
|
* read and write data. A socket begins in a _connected_ state (if the
|
|
@@ -3681,15 +3740,20 @@ declare namespace Switch {
|
|
|
3681
3740
|
close(): void;
|
|
3682
3741
|
}
|
|
3683
3742
|
/**
|
|
3684
|
-
*
|
|
3685
|
-
*
|
|
3686
|
-
* @example
|
|
3743
|
+
* A Map-like object providing methods to interact with the environment variables of the process.
|
|
3687
3744
|
*
|
|
3688
|
-
*
|
|
3689
|
-
* const ipAddresses = await Switch.resolveDns('example.com');
|
|
3690
|
-
* ```
|
|
3745
|
+
* Use {@link env | `Switch.env`} to access the singleton instance of this class.
|
|
3691
3746
|
*/
|
|
3692
|
-
declare
|
|
3747
|
+
declare class Env {
|
|
3748
|
+
/**
|
|
3749
|
+
* @private
|
|
3750
|
+
*/
|
|
3751
|
+
constructor();
|
|
3752
|
+
get(name: string): string | undefined;
|
|
3753
|
+
set(name: string, value: string): void;
|
|
3754
|
+
delete(name: string): void;
|
|
3755
|
+
toObject(): Record<string, string>;
|
|
3756
|
+
}
|
|
3693
3757
|
interface ReadFileOptions {
|
|
3694
3758
|
/**
|
|
3695
3759
|
* Byte offset to start reading the file from.
|
|
@@ -3857,126 +3921,102 @@ declare namespace Switch {
|
|
|
3857
3921
|
stream(opts?: FsFileStreamOptions): ReadableStream<Uint8Array>;
|
|
3858
3922
|
get writable(): WritableStream<string | BufferSource>;
|
|
3859
3923
|
}
|
|
3860
|
-
interface InspectOptions {
|
|
3861
|
-
depth?: number;
|
|
3862
|
-
refs?: Map<{}, number>;
|
|
3863
|
-
}
|
|
3864
3924
|
/**
|
|
3865
|
-
*
|
|
3866
|
-
*
|
|
3867
|
-
* It can handle and correctly output different types of values including primitives, functions, arrays, and objects.
|
|
3925
|
+
* The `Switch.Album` class allows for interacting with the Switch's photo gallery,
|
|
3926
|
+
* providing access to the screenshots / video recordings that the user has saved.
|
|
3868
3927
|
*
|
|
3869
|
-
*
|
|
3870
|
-
* @
|
|
3871
|
-
*
|
|
3928
|
+
* It is a `Set` subclass, which contains entries of
|
|
3929
|
+
* {@link AlbumFile | `Switch.AlbumFile`} instances.
|
|
3930
|
+
*
|
|
3931
|
+
* @example
|
|
3932
|
+
*
|
|
3933
|
+
* ```typescript
|
|
3934
|
+
* import { CapsAlbumStorage } from '@nx.js/constants';
|
|
3935
|
+
*
|
|
3936
|
+
* const album = new Switch.Album(CapsAlbumStorage.Sd);
|
|
3937
|
+
* for (const file of album) {
|
|
3938
|
+
* console.log(file);
|
|
3939
|
+
* }
|
|
3940
|
+
* ```
|
|
3872
3941
|
*/
|
|
3873
|
-
declare
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
entries:
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3942
|
+
declare class Album extends Set<AlbumFile> {
|
|
3943
|
+
readonly storage: number;
|
|
3944
|
+
constructor(storage: number);
|
|
3945
|
+
values(): SetIterator<AlbumFile>;
|
|
3946
|
+
keys(): SetIterator<AlbumFile>;
|
|
3947
|
+
entries(): SetIterator<[
|
|
3948
|
+
AlbumFile,
|
|
3949
|
+
AlbumFile
|
|
3950
|
+
]>;
|
|
3951
|
+
[Symbol.iterator](): SetIterator<AlbumFile>;
|
|
3952
|
+
}
|
|
3884
3953
|
/**
|
|
3885
|
-
* Represents a
|
|
3954
|
+
* Represents a file within a {@link Album | `Switch.Album`} content store,
|
|
3955
|
+
* which is either a screenshot (JPEG image) or a screen recording (MP4 movie).
|
|
3956
|
+
*
|
|
3957
|
+
* It is a subclass of `File`, so you can use familiar features like `name`,
|
|
3958
|
+
* `lastModified` and `arrayBuffer()`. It also has additional metadata like
|
|
3959
|
+
* `applicationId` to determine which application generated the contents.
|
|
3960
|
+
*
|
|
3961
|
+
* @example
|
|
3962
|
+
*
|
|
3963
|
+
* ```typescript
|
|
3964
|
+
* const ctx = screen.getContext('2d');
|
|
3965
|
+
* const buf = await file.arrayBuffer();
|
|
3966
|
+
* const img = await createImageBitmap(new Blob([buf]));
|
|
3967
|
+
* ctx.drawImage(img, 0, 0);
|
|
3968
|
+
* ```
|
|
3886
3969
|
*/
|
|
3887
|
-
declare class
|
|
3888
|
-
/**
|
|
3889
|
-
* The unique ID of the profile, represented as an array of two `bigint` values.
|
|
3890
|
-
*/
|
|
3891
|
-
readonly uid: ProfileUid;
|
|
3892
|
-
/**
|
|
3893
|
-
* The human readable nickname of the profile.
|
|
3894
|
-
*/
|
|
3895
|
-
readonly nickname: string;
|
|
3970
|
+
declare class AlbumFile extends File {
|
|
3896
3971
|
/**
|
|
3897
|
-
* The
|
|
3972
|
+
* The ID of the application which generated the album file.
|
|
3898
3973
|
*/
|
|
3899
|
-
|
|
3974
|
+
applicationId: bigint;
|
|
3900
3975
|
/**
|
|
3901
|
-
*
|
|
3902
|
-
*
|
|
3903
|
-
* @example
|
|
3904
|
-
*
|
|
3905
|
-
* ```typescript
|
|
3906
|
-
* const profile = new Switch.Profile([
|
|
3907
|
-
* 0x10005d4864d166b7n,
|
|
3908
|
-
* 0x965b8cb028cd8a81n,
|
|
3909
|
-
* ]);
|
|
3910
|
-
* console.log(profile.nickname);
|
|
3911
|
-
* ```
|
|
3976
|
+
* The type of content which the album file contains. The value
|
|
3977
|
+
* corresponds with the `CapsAlbumFileContents` enum from `@nx.js/constants`.
|
|
3912
3978
|
*/
|
|
3913
|
-
|
|
3979
|
+
content: number;
|
|
3914
3980
|
/**
|
|
3915
|
-
*
|
|
3916
|
-
*
|
|
3917
|
-
* Initially, this value will correspond to the user profile that was selected
|
|
3918
|
-
* via the user selection interface when the application was launched.
|
|
3919
|
-
*
|
|
3920
|
-
* Will be `null` if no user profile is currently selected.
|
|
3921
|
-
*
|
|
3922
|
-
* @example
|
|
3923
|
-
*
|
|
3924
|
-
* ```typescript
|
|
3925
|
-
* const profile = Switch.Profile.current;
|
|
3926
|
-
* if (profile) {
|
|
3927
|
-
* console.log(`Current user: ${profile.nickname}`);
|
|
3928
|
-
* } else {
|
|
3929
|
-
* console.log('No user is currently selected');
|
|
3930
|
-
* }
|
|
3931
|
-
* ```
|
|
3981
|
+
* The storage device which contains the album file. The value
|
|
3982
|
+
* corresponds with the `CapsAlbumStorage` enum from `@nx.js/constants`.
|
|
3932
3983
|
*/
|
|
3933
|
-
|
|
3934
|
-
static get current(): Profile | null;
|
|
3984
|
+
storage: number;
|
|
3935
3985
|
/**
|
|
3936
|
-
*
|
|
3937
|
-
* instance representing the user that was selected.
|
|
3986
|
+
* Unique ID for when there's multiple album files with the same timestamp.
|
|
3938
3987
|
*
|
|
3939
|
-
* @note
|
|
3988
|
+
* @note The value is usually `0`.
|
|
3940
3989
|
*/
|
|
3941
|
-
|
|
3990
|
+
id: number;
|
|
3991
|
+
constructor(storage: number, id: string);
|
|
3992
|
+
text(): Promise<string>;
|
|
3993
|
+
slice(start?: number, end?: number, type?: string): Blob;
|
|
3994
|
+
stream(): ReadableStream<Uint8Array>;
|
|
3942
3995
|
/**
|
|
3943
|
-
*
|
|
3996
|
+
* Loads the thumbnail JPEG image for the album file.
|
|
3944
3997
|
*
|
|
3945
3998
|
* @example
|
|
3946
3999
|
*
|
|
3947
4000
|
* ```typescript
|
|
3948
|
-
*
|
|
3949
|
-
*
|
|
3950
|
-
*
|
|
4001
|
+
* const ctx = screen.getContext('2d');
|
|
4002
|
+
* const buf = await file.thumbnail();
|
|
4003
|
+
* const img = await createImageBitmap(new Blob([buf]));
|
|
4004
|
+
* ctx.drawImage(img, 0, 0);
|
|
3951
4005
|
* ```
|
|
3952
4006
|
*/
|
|
3953
|
-
|
|
3954
|
-
}
|
|
3955
|
-
interface SaveDataCreationInfoBase {
|
|
3956
|
-
spaceId: number;
|
|
3957
|
-
type: number;
|
|
3958
|
-
size: bigint;
|
|
3959
|
-
journalSize: bigint;
|
|
3960
|
-
uid?: ProfileUid;
|
|
3961
|
-
systemId?: bigint;
|
|
3962
|
-
applicationId?: bigint;
|
|
3963
|
-
index?: number;
|
|
3964
|
-
rank?: number;
|
|
3965
|
-
}
|
|
3966
|
-
interface SaveDataCreationInfoWithNacp {
|
|
3967
|
-
spaceId: number;
|
|
3968
|
-
type: number;
|
|
3969
|
-
size?: bigint;
|
|
3970
|
-
journalSize?: bigint;
|
|
3971
|
-
uid?: ProfileUid;
|
|
3972
|
-
index?: number;
|
|
3973
|
-
rank?: number;
|
|
4007
|
+
thumbnail(): Promise<ArrayBuffer>;
|
|
3974
4008
|
}
|
|
3975
|
-
type SaveDataCreationInfo = SaveDataCreationInfoBase | SaveDataCreationInfoWithNacp;
|
|
3976
4009
|
/**
|
|
3977
|
-
*
|
|
4010
|
+
* Performs a DNS lookup to resolve a hostname to an array of IP addresses.
|
|
4011
|
+
*
|
|
4012
|
+
* @example
|
|
4013
|
+
*
|
|
4014
|
+
* ```typescript
|
|
4015
|
+
* const ipAddresses = await Switch.resolveDns('example.com');
|
|
4016
|
+
* ```
|
|
3978
4017
|
*/
|
|
3979
|
-
declare
|
|
4018
|
+
declare function resolveDns(hostname: string): Promise<string[]>;
|
|
4019
|
+
declare class FileSystem {
|
|
3980
4020
|
/**
|
|
3981
4021
|
* A `URL` instance that points to the root of the filesystem mount.
|
|
3982
4022
|
* You should use this to create file path references within
|
|
@@ -3985,33 +4025,295 @@ declare namespace Switch {
|
|
|
3985
4025
|
* @example
|
|
3986
4026
|
*
|
|
3987
4027
|
* ```typescript
|
|
3988
|
-
* const dataUrl = new URL('data.json',
|
|
4028
|
+
* const dataUrl = new URL('data.json', fileSystem.url);
|
|
3989
4029
|
* ```
|
|
3990
4030
|
*/
|
|
3991
4031
|
url: URL | null;
|
|
3992
|
-
readonly id: bigint;
|
|
3993
|
-
readonly spaceId: number;
|
|
3994
|
-
readonly type: number;
|
|
3995
|
-
readonly uid: ProfileUid;
|
|
3996
|
-
readonly systemId: bigint;
|
|
3997
|
-
readonly applicationId: bigint;
|
|
3998
|
-
readonly size: bigint;
|
|
3999
|
-
readonly index: number;
|
|
4000
|
-
readonly rank: number;
|
|
4001
4032
|
/**
|
|
4002
4033
|
* @private
|
|
4003
4034
|
*/
|
|
4004
4035
|
constructor();
|
|
4005
4036
|
/**
|
|
4006
|
-
*
|
|
4037
|
+
* The amount of free space available on the filesystem, in bytes.
|
|
4038
|
+
*/
|
|
4039
|
+
freeSpace(): bigint;
|
|
4040
|
+
/**
|
|
4041
|
+
* The total amount of space available on the filesystem, in bytes.
|
|
4042
|
+
*/
|
|
4043
|
+
totalSpace(): bigint;
|
|
4044
|
+
/**
|
|
4045
|
+
* Mounts the `FileSystem` such that filesystem operations may be used.
|
|
4007
4046
|
*
|
|
4008
|
-
*
|
|
4047
|
+
* @param name The name of the mount for filesystem paths. By default, a random name is generated. Should not exceed 31 characters, and should not have a trailing colon.
|
|
4048
|
+
*/
|
|
4049
|
+
mount(name?: string): URL;
|
|
4050
|
+
/**
|
|
4051
|
+
* Opens a file system partition specified by its `BisPartitionId`.
|
|
4009
4052
|
*
|
|
4010
4053
|
* @example
|
|
4011
4054
|
*
|
|
4012
4055
|
* ```typescript
|
|
4013
|
-
*
|
|
4014
|
-
*
|
|
4056
|
+
* import { BisPartitionId } from '@nx.js/constants';
|
|
4057
|
+
*
|
|
4058
|
+
* // Open and mount the "User" partition
|
|
4059
|
+
* const fs = Switch.FileSystem.openBis(BisPartitionId.User);
|
|
4060
|
+
* const url = fs.mount();
|
|
4061
|
+
*
|
|
4062
|
+
* // Read the file entries at the root of the partition
|
|
4063
|
+
* console.log(Switch.readDirSync(url));
|
|
4064
|
+
* ```
|
|
4065
|
+
*
|
|
4066
|
+
* @param id The `BisPartitionId` of the partition to open.
|
|
4067
|
+
*/
|
|
4068
|
+
static openBis(id: number): FileSystem;
|
|
4069
|
+
/**
|
|
4070
|
+
* Opens a file system partition for the SD card.
|
|
4071
|
+
*
|
|
4072
|
+
* Note that the SD card is automatically mounted under the `sdmc:` protocol,
|
|
4073
|
+
* so your application will not need to call this function under most circumstances.
|
|
4074
|
+
* However, it is useful for querying metatdata about the SD card, such as
|
|
4075
|
+
* the amount of free space available.
|
|
4076
|
+
*
|
|
4077
|
+
* @example
|
|
4078
|
+
*
|
|
4079
|
+
* ```typescript
|
|
4080
|
+
* const fs = Switch.FileSystem.openSdmc();
|
|
4081
|
+
* console.log(fs.freeSpace());
|
|
4082
|
+
* console.log(fs.totalSpace());
|
|
4083
|
+
* ```
|
|
4084
|
+
*/
|
|
4085
|
+
static openSdmc(): FileSystem;
|
|
4086
|
+
/**
|
|
4087
|
+
* Opens a file system partition for the application with the specified title ID.
|
|
4088
|
+
* The file system type is specified by the `FsFileSystemType` parameter.
|
|
4089
|
+
*
|
|
4090
|
+
* @example
|
|
4091
|
+
*
|
|
4092
|
+
* ```typescript
|
|
4093
|
+
* import { FsFileSystemType } from '@nx.js/constants';
|
|
4094
|
+
*
|
|
4095
|
+
* // Open and mount the "User" partition
|
|
4096
|
+
* const fs = Switch.FileSystem.openWithId(
|
|
4097
|
+
* 0x0100000000001000n,
|
|
4098
|
+
* FsFileSystemType.ContentMeta,
|
|
4099
|
+
* );
|
|
4100
|
+
* const url = fs.mount();
|
|
4101
|
+
*
|
|
4102
|
+
* // Read the file entries at the root of the file system
|
|
4103
|
+
* console.log(Switch.readDirSync(url));
|
|
4104
|
+
* ```
|
|
4105
|
+
*
|
|
4106
|
+
* @param titleId The title ID of the file system to open.
|
|
4107
|
+
* @param type The `FsFileSystemType` of the file system to open.
|
|
4108
|
+
* @param path The base path of the file system to open. Defaults to `/`.
|
|
4109
|
+
*/
|
|
4110
|
+
static openWithId(titleId: bigint, type: number, path?: string): FileSystem;
|
|
4111
|
+
}
|
|
4112
|
+
interface InspectOptions {
|
|
4113
|
+
depth?: number;
|
|
4114
|
+
refs?: Map<{}, number>;
|
|
4115
|
+
}
|
|
4116
|
+
/**
|
|
4117
|
+
* Inspects a given value and returns a string representation of it.
|
|
4118
|
+
* The function uses ANSI color codes to highlight different parts of the output.
|
|
4119
|
+
* It can handle and correctly output different types of values including primitives, functions, arrays, and objects.
|
|
4120
|
+
*
|
|
4121
|
+
* @param v The value to inspect.
|
|
4122
|
+
* @param opts Options which may modify the generated string representation of the value.
|
|
4123
|
+
* @returns A string representation of `v` with ANSI color codes.
|
|
4124
|
+
*/
|
|
4125
|
+
declare const inspect: {
|
|
4126
|
+
(v: unknown, opts?: InspectOptions): string;
|
|
4127
|
+
custom: symbol;
|
|
4128
|
+
keys: symbol;
|
|
4129
|
+
values: symbol;
|
|
4130
|
+
entries: symbol;
|
|
4131
|
+
};
|
|
4132
|
+
interface IRSensorInit {
|
|
4133
|
+
/**
|
|
4134
|
+
* The desired number of times per second a sample should be taken,
|
|
4135
|
+
* meaning the number of times per second that the `reading` event
|
|
4136
|
+
* will be called. A whole number or decimal may be used, the latter
|
|
4137
|
+
* for frequencies less than a second.
|
|
4138
|
+
*
|
|
4139
|
+
* @default 2
|
|
4140
|
+
*/
|
|
4141
|
+
frequency?: number;
|
|
4142
|
+
/**
|
|
4143
|
+
* CSS color that will be used when rendering the image produced by
|
|
4144
|
+
* the IR sensor.
|
|
4145
|
+
*
|
|
4146
|
+
* @default "green"
|
|
4147
|
+
*/
|
|
4148
|
+
color?: string;
|
|
4149
|
+
}
|
|
4150
|
+
/**
|
|
4151
|
+
* The `IRSensor` class reads the controller's IR (infrared) camera,
|
|
4152
|
+
* allowing the application to get the image data for each frame of
|
|
4153
|
+
* the camera.
|
|
4154
|
+
*
|
|
4155
|
+
* @example
|
|
4156
|
+
*
|
|
4157
|
+
* ```typescript
|
|
4158
|
+
* const ctx = screen.getContext('2d');
|
|
4159
|
+
*
|
|
4160
|
+
* const sensor = new Switch.IRSensor();
|
|
4161
|
+
* sensor.addEventListener('reading', () => {
|
|
4162
|
+
* ctx.drawImage(sensor.image, 0, 0);
|
|
4163
|
+
* });
|
|
4164
|
+
* sensor.start();
|
|
4165
|
+
* ```
|
|
4166
|
+
*/
|
|
4167
|
+
declare class IRSensor extends Sensor {
|
|
4168
|
+
constructor(opts?: IRSensorInit);
|
|
4169
|
+
/**
|
|
4170
|
+
* The underlying `ImageBitmap` instance containing the contents
|
|
4171
|
+
* of the IR sensor. Can be used with `ctx.drawImage()` or any
|
|
4172
|
+
* other functions that work with `ImageBitmap` instances.
|
|
4173
|
+
*/
|
|
4174
|
+
get image(): ImageBitmap;
|
|
4175
|
+
get activated(): boolean;
|
|
4176
|
+
get hasReading(): boolean;
|
|
4177
|
+
get timestamp(): number | null;
|
|
4178
|
+
start(): void;
|
|
4179
|
+
stop(): void;
|
|
4180
|
+
}
|
|
4181
|
+
declare function networkInfo(): NetworkInfo;
|
|
4182
|
+
type ProfileUid = [
|
|
4183
|
+
bigint,
|
|
4184
|
+
bigint
|
|
4185
|
+
];
|
|
4186
|
+
/**
|
|
4187
|
+
* Represents a user profile that exists on the system.
|
|
4188
|
+
*/
|
|
4189
|
+
declare class Profile {
|
|
4190
|
+
/**
|
|
4191
|
+
* The unique ID of the profile, represented as an array of two `bigint` values.
|
|
4192
|
+
*/
|
|
4193
|
+
readonly uid: ProfileUid;
|
|
4194
|
+
/**
|
|
4195
|
+
* The human readable nickname of the profile.
|
|
4196
|
+
*/
|
|
4197
|
+
readonly nickname: string;
|
|
4198
|
+
/**
|
|
4199
|
+
* The raw JPEG data for the profile image. Can be decoded with the `Image` class.
|
|
4200
|
+
*/
|
|
4201
|
+
readonly image: ArrayBuffer;
|
|
4202
|
+
/**
|
|
4203
|
+
* Creates a new `Profile` instance from the given profile UID.
|
|
4204
|
+
*
|
|
4205
|
+
* @example
|
|
4206
|
+
*
|
|
4207
|
+
* ```typescript
|
|
4208
|
+
* const profile = new Switch.Profile([
|
|
4209
|
+
* 0x10005d4864d166b7n,
|
|
4210
|
+
* 0x965b8cb028cd8a81n,
|
|
4211
|
+
* ]);
|
|
4212
|
+
* console.log(profile.nickname);
|
|
4213
|
+
* ```
|
|
4214
|
+
*/
|
|
4215
|
+
constructor(uid: ProfileUid);
|
|
4216
|
+
/**
|
|
4217
|
+
* Gets or sets the "current" user profile.
|
|
4218
|
+
*
|
|
4219
|
+
* Initially, this value will correspond to the user profile that was selected
|
|
4220
|
+
* via the user selection interface when the application was launched.
|
|
4221
|
+
*
|
|
4222
|
+
* Will be `null` if no user profile is currently selected.
|
|
4223
|
+
*
|
|
4224
|
+
* @example
|
|
4225
|
+
*
|
|
4226
|
+
* ```typescript
|
|
4227
|
+
* const profile = Switch.Profile.current;
|
|
4228
|
+
* if (profile) {
|
|
4229
|
+
* console.log(`Current user: ${profile.nickname}`);
|
|
4230
|
+
* } else {
|
|
4231
|
+
* console.log('No user is currently selected');
|
|
4232
|
+
* }
|
|
4233
|
+
* ```
|
|
4234
|
+
*/
|
|
4235
|
+
static set current(v: Profile | null);
|
|
4236
|
+
static get current(): Profile | null;
|
|
4237
|
+
/**
|
|
4238
|
+
* Shows the user selection interface and returns a {@link Profile}
|
|
4239
|
+
* instance representing the user that was selected.
|
|
4240
|
+
*
|
|
4241
|
+
* @note This function blocks the event loop until the user has made their selection.
|
|
4242
|
+
*/
|
|
4243
|
+
static select(): Profile | null;
|
|
4244
|
+
/**
|
|
4245
|
+
* Can be used as an iterator to retrieve the list of user profiles.
|
|
4246
|
+
*
|
|
4247
|
+
* @example
|
|
4248
|
+
*
|
|
4249
|
+
* ```typescript
|
|
4250
|
+
* for (const profile of Switch.Profile) {
|
|
4251
|
+
* console.log(profile.nickname);
|
|
4252
|
+
* }
|
|
4253
|
+
* ```
|
|
4254
|
+
*/
|
|
4255
|
+
static [Symbol.iterator](): Generator<Profile, void, unknown>;
|
|
4256
|
+
}
|
|
4257
|
+
interface SaveDataCreationInfoBase {
|
|
4258
|
+
spaceId: number;
|
|
4259
|
+
type: number;
|
|
4260
|
+
size: bigint;
|
|
4261
|
+
journalSize: bigint;
|
|
4262
|
+
uid?: ProfileUid;
|
|
4263
|
+
systemId?: bigint;
|
|
4264
|
+
applicationId?: bigint;
|
|
4265
|
+
index?: number;
|
|
4266
|
+
rank?: number;
|
|
4267
|
+
}
|
|
4268
|
+
interface SaveDataCreationInfoWithNacp {
|
|
4269
|
+
spaceId: number;
|
|
4270
|
+
type: number;
|
|
4271
|
+
size?: bigint;
|
|
4272
|
+
journalSize?: bigint;
|
|
4273
|
+
uid?: ProfileUid;
|
|
4274
|
+
index?: number;
|
|
4275
|
+
rank?: number;
|
|
4276
|
+
}
|
|
4277
|
+
type SaveDataCreationInfo = SaveDataCreationInfoBase | SaveDataCreationInfoWithNacp;
|
|
4278
|
+
/**
|
|
4279
|
+
* Represents a "save data store".
|
|
4280
|
+
*/
|
|
4281
|
+
declare class SaveData {
|
|
4282
|
+
/**
|
|
4283
|
+
* A `URL` instance that points to the root of the filesystem mount.
|
|
4284
|
+
* You should use this to create file path references within
|
|
4285
|
+
* the filesystem mount.
|
|
4286
|
+
*
|
|
4287
|
+
* @example
|
|
4288
|
+
*
|
|
4289
|
+
* ```typescript
|
|
4290
|
+
* const dataUrl = new URL('data.json', saveData.url);
|
|
4291
|
+
* ```
|
|
4292
|
+
*/
|
|
4293
|
+
url: URL | null;
|
|
4294
|
+
readonly id: bigint;
|
|
4295
|
+
readonly spaceId: number;
|
|
4296
|
+
readonly type: number;
|
|
4297
|
+
readonly uid: ProfileUid;
|
|
4298
|
+
readonly systemId: bigint;
|
|
4299
|
+
readonly applicationId: bigint;
|
|
4300
|
+
readonly size: bigint;
|
|
4301
|
+
readonly index: number;
|
|
4302
|
+
readonly rank: number;
|
|
4303
|
+
/**
|
|
4304
|
+
* @private
|
|
4305
|
+
*/
|
|
4306
|
+
constructor();
|
|
4307
|
+
/**
|
|
4308
|
+
* Commits to the disk any write operations that have occurred on this filesystem mount since the previous commit.
|
|
4309
|
+
*
|
|
4310
|
+
* > WARNING: Failure to call this function after writes will cause the data to be lost after the application exits.
|
|
4311
|
+
*
|
|
4312
|
+
* @example
|
|
4313
|
+
*
|
|
4314
|
+
* ```typescript
|
|
4315
|
+
* const saveStateUrl = new URL('state', saveData.url);
|
|
4316
|
+
* Switch.writeFileSync(saveStateUrl, 'my application state...');
|
|
4015
4317
|
*
|
|
4016
4318
|
* saveData.commit(); // Write operation is persisted to the disk
|
|
4017
4319
|
* ```
|
|
@@ -4058,7 +4360,6 @@ declare namespace Switch {
|
|
|
4058
4360
|
static createSync(init: SaveDataCreationInfoWithNacp, nacp: ArrayBuffer): SaveData;
|
|
4059
4361
|
static [Symbol.iterator](): Generator<SaveData, void, unknown>;
|
|
4060
4362
|
}
|
|
4061
|
-
declare function networkInfo(): NetworkInfo;
|
|
4062
4363
|
/**
|
|
4063
4364
|
* Represents an installed application (game) on the console,
|
|
4064
4365
|
* or a homebrew application (`.nro` file).
|
|
@@ -4174,254 +4475,136 @@ declare namespace Switch {
|
|
|
4174
4475
|
static get self(): Application;
|
|
4175
4476
|
static [Symbol.iterator](): Generator<Application, void, unknown>;
|
|
4176
4477
|
}
|
|
4177
|
-
interface
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4478
|
+
interface ServiceDispatchParams {
|
|
4479
|
+
targetSession?: number;
|
|
4480
|
+
context?: number;
|
|
4481
|
+
bufferAttrs?: number[];
|
|
4482
|
+
buffers?: BufferSource[];
|
|
4483
|
+
inSendPid?: boolean;
|
|
4484
|
+
inObjects?: Service[];
|
|
4485
|
+
inHandles?: number[];
|
|
4486
|
+
outObjects?: Service[];
|
|
4487
|
+
outHandleAttrs?: number[];
|
|
4488
|
+
outHandles?: number[];
|
|
4489
|
+
}
|
|
4490
|
+
declare class Service {
|
|
4491
|
+
constructor(name?: string);
|
|
4492
|
+
isActive(): void;
|
|
4493
|
+
isDomain(): void;
|
|
4494
|
+
isOverride(): void;
|
|
4495
|
+
dispatch(rid: number, params?: ServiceDispatchParams): void;
|
|
4496
|
+
dispatchIn(rid: number, inData: BufferSource, parmas?: ServiceDispatchParams): void;
|
|
4497
|
+
dispatchOut(rid: number, outData: BufferSource, params?: ServiceDispatchParams): void;
|
|
4498
|
+
dispatchInOut(rid: number, inData?: BufferSource, outData?: BufferSource, params?: ServiceDispatchParams): void;
|
|
4194
4499
|
}
|
|
4195
4500
|
/**
|
|
4196
|
-
*
|
|
4197
|
-
*
|
|
4198
|
-
* the camera.
|
|
4199
|
-
*
|
|
4200
|
-
* @example
|
|
4201
|
-
*
|
|
4202
|
-
* ```typescript
|
|
4203
|
-
* const ctx = screen.getContext('2d');
|
|
4204
|
-
*
|
|
4205
|
-
* const sensor = new Switch.IRSensor();
|
|
4206
|
-
* sensor.addEventListener('reading', () => {
|
|
4207
|
-
* ctx.drawImage(sensor.image, 0, 0);
|
|
4208
|
-
* });
|
|
4209
|
-
* sensor.start();
|
|
4210
|
-
* ```
|
|
4501
|
+
* Configuration options for {@link WebApplet.start | `WebApplet.start()`}.
|
|
4502
|
+
* All values are optional and only take effect at launch time.
|
|
4211
4503
|
*/
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4504
|
+
interface WebAppletOptions {
|
|
4505
|
+
/** Enable the `window.nx` JavaScript API in the browser for bidirectional messaging. */
|
|
4506
|
+
jsExtension?: boolean;
|
|
4507
|
+
/** Start the browser hidden (can be shown later with {@link WebApplet.appear | `appear()`}). */
|
|
4508
|
+
bootHidden?: boolean;
|
|
4509
|
+
/** Whether to show the footer (address bar). */
|
|
4510
|
+
footer?: boolean;
|
|
4511
|
+
/** Whether to show a pointer cursor. */
|
|
4512
|
+
pointer?: boolean;
|
|
4513
|
+
/** Left stick behavior: `'pointer'` (move pointer) or `'cursor'` (scroll). */
|
|
4514
|
+
leftStickMode?: "pointer" | "cursor";
|
|
4515
|
+
/** Boot display screen color. */
|
|
4516
|
+
bootDisplayKind?: "default" | "white" | "black";
|
|
4517
|
+
/** Background kind. */
|
|
4518
|
+
backgroundKind?: "default";
|
|
4519
|
+
/** Footer fixed display kind. */
|
|
4520
|
+
footerFixedKind?: "default" | "always" | "hidden";
|
|
4521
|
+
/** Boot as a media player applet. */
|
|
4522
|
+
bootAsMediaPlayer?: boolean;
|
|
4523
|
+
/** Enable/disable screenshot capture (Web mode only). */
|
|
4524
|
+
screenShot?: boolean;
|
|
4525
|
+
/** Enable/disable the page cache. */
|
|
4526
|
+
pageCache?: boolean;
|
|
4527
|
+
/** Enable/disable Web Audio API. */
|
|
4528
|
+
webAudio?: boolean;
|
|
4529
|
+
/** Enable/disable page fade transition. */
|
|
4530
|
+
pageFade?: boolean;
|
|
4531
|
+
/** Show/hide the boot loading icon (Offline mode only). */
|
|
4532
|
+
bootLoadingIcon?: boolean;
|
|
4533
|
+
/** Show/hide the page scroll indicator. */
|
|
4534
|
+
pageScrollIndicator?: boolean;
|
|
4535
|
+
/** Enable/disable media player speed controls. */
|
|
4536
|
+
mediaPlayerSpeedControl?: boolean;
|
|
4537
|
+
/** Enable/disable media autoplay. */
|
|
4538
|
+
mediaAutoPlay?: boolean;
|
|
4539
|
+
/** Override web audio volume (0.0 to 1.0). */
|
|
4540
|
+
overrideWebAudioVolume?: number;
|
|
4541
|
+
/** Override media audio volume (0.0 to 1.0). */
|
|
4542
|
+
overrideMediaAudioVolume?: number;
|
|
4543
|
+
/** Enable/disable media player auto-close on end. */
|
|
4544
|
+
mediaPlayerAutoClose?: boolean;
|
|
4545
|
+
/** Show/hide media player UI (Offline mode only). */
|
|
4546
|
+
mediaPlayerUi?: boolean;
|
|
4547
|
+
/** Additional string appended to the user agent (Web mode only). */
|
|
4548
|
+
userAgentAdditionalString?: string;
|
|
4225
4549
|
}
|
|
4226
4550
|
/**
|
|
4227
|
-
*
|
|
4228
|
-
*
|
|
4229
|
-
*
|
|
4230
|
-
* It is a `Set` subclass, which contains entries of
|
|
4231
|
-
* {@link AlbumFile | `Switch.AlbumFile`} instances.
|
|
4232
|
-
*
|
|
4233
|
-
* @example
|
|
4551
|
+
* Opens the Switch's built-in web browser as a Library Applet.
|
|
4552
|
+
* Requires Application mode (NSP install or hbmenu via title override).
|
|
4234
4553
|
*
|
|
4554
|
+
* @example Non-blocking with messaging
|
|
4235
4555
|
* ```typescript
|
|
4236
|
-
*
|
|
4237
|
-
*
|
|
4238
|
-
* const album = new Switch.Album(CapsAlbumStorage.Sd);
|
|
4239
|
-
* for (const file of album) {
|
|
4240
|
-
* console.log(file);
|
|
4241
|
-
* }
|
|
4242
|
-
* ```
|
|
4243
|
-
*/
|
|
4244
|
-
declare class Album extends Set<AlbumFile> {
|
|
4245
|
-
readonly storage: number;
|
|
4246
|
-
constructor(storage: number);
|
|
4247
|
-
values(): SetIterator<AlbumFile>;
|
|
4248
|
-
keys(): SetIterator<AlbumFile>;
|
|
4249
|
-
entries(): SetIterator<[
|
|
4250
|
-
AlbumFile,
|
|
4251
|
-
AlbumFile
|
|
4252
|
-
]>;
|
|
4253
|
-
[Symbol.iterator](): SetIterator<AlbumFile>;
|
|
4254
|
-
}
|
|
4255
|
-
/**
|
|
4256
|
-
* Represents a file within a {@link Album | `Switch.Album`} content store,
|
|
4257
|
-
* which is either a screenshot (JPEG image) or a screen recording (MP4 movie).
|
|
4556
|
+
* const applet = new Switch.WebApplet('https://myapp.example.com');
|
|
4258
4557
|
*
|
|
4259
|
-
*
|
|
4260
|
-
*
|
|
4261
|
-
*
|
|
4558
|
+
* applet.addEventListener('message', (e) => {
|
|
4559
|
+
* console.log('From browser:', e.data);
|
|
4560
|
+
* applet.sendMessage('response');
|
|
4561
|
+
* });
|
|
4262
4562
|
*
|
|
4263
|
-
*
|
|
4563
|
+
* applet.addEventListener('exit', () => {
|
|
4564
|
+
* console.log('Browser closed');
|
|
4565
|
+
* });
|
|
4264
4566
|
*
|
|
4265
|
-
*
|
|
4266
|
-
* const ctx = screen.getContext('2d');
|
|
4267
|
-
* const buf = await file.arrayBuffer();
|
|
4268
|
-
* const img = await createImageBitmap(new Blob([buf]));
|
|
4269
|
-
* ctx.drawImage(img, 0, 0);
|
|
4567
|
+
* await applet.start({ jsExtension: true });
|
|
4270
4568
|
* ```
|
|
4271
4569
|
*/
|
|
4272
|
-
declare class
|
|
4570
|
+
declare class WebApplet extends EventTarget {
|
|
4571
|
+
#private;
|
|
4572
|
+
constructor(url: string);
|
|
4273
4573
|
/**
|
|
4274
|
-
*
|
|
4574
|
+
* Whether the browser applet is currently running.
|
|
4275
4575
|
*/
|
|
4276
|
-
|
|
4576
|
+
get running(): boolean;
|
|
4277
4577
|
/**
|
|
4278
|
-
* The
|
|
4279
|
-
*
|
|
4578
|
+
* The current operating mode:
|
|
4579
|
+
* - `'web-session'` — HTTP/HTTPS URL with WebSession (supports `window.nx` messaging)
|
|
4580
|
+
* - `'htmldoc'` — HtmlDocument applet loading HTML from app's html-document NCA (supports `window.nx` messaging)
|
|
4581
|
+
* - `'none'` — not started
|
|
4280
4582
|
*/
|
|
4281
|
-
|
|
4583
|
+
get mode(): string;
|
|
4282
4584
|
/**
|
|
4283
|
-
*
|
|
4284
|
-
*
|
|
4585
|
+
* Opens the browser. The nx.js event loop continues running.
|
|
4586
|
+
* Pass an options object to configure the applet before launch.
|
|
4587
|
+
* Listen for `'message'` and `'exit'` events.
|
|
4285
4588
|
*/
|
|
4286
|
-
|
|
4589
|
+
start(options?: WebAppletOptions): Promise<void>;
|
|
4287
4590
|
/**
|
|
4288
|
-
*
|
|
4289
|
-
*
|
|
4290
|
-
* @note The value is usually `0`.
|
|
4591
|
+
* Make the browser visible if it was started hidden.
|
|
4291
4592
|
*/
|
|
4292
|
-
|
|
4293
|
-
constructor(storage: number, id: string);
|
|
4294
|
-
text(): Promise<string>;
|
|
4295
|
-
slice(start?: number, end?: number, type?: string): Blob;
|
|
4296
|
-
stream(): ReadableStream<Uint8Array>;
|
|
4593
|
+
appear(): void;
|
|
4297
4594
|
/**
|
|
4298
|
-
*
|
|
4299
|
-
*
|
|
4300
|
-
*
|
|
4301
|
-
*
|
|
4302
|
-
* ```typescript
|
|
4303
|
-
* const ctx = screen.getContext('2d');
|
|
4304
|
-
* const buf = await file.thumbnail();
|
|
4305
|
-
* const img = await createImageBitmap(new Blob([buf]));
|
|
4306
|
-
* ctx.drawImage(img, 0, 0);
|
|
4307
|
-
* ```
|
|
4308
|
-
*/
|
|
4309
|
-
thumbnail(): Promise<ArrayBuffer>;
|
|
4310
|
-
}
|
|
4311
|
-
declare class FileSystem {
|
|
4312
|
-
/**
|
|
4313
|
-
* A `URL` instance that points to the root of the filesystem mount.
|
|
4314
|
-
* You should use this to create file path references within
|
|
4315
|
-
* the filesystem mount.
|
|
4316
|
-
*
|
|
4317
|
-
* @example
|
|
4318
|
-
*
|
|
4319
|
-
* ```typescript
|
|
4320
|
-
* const dataUrl = new URL('data.json', fileSystem.url);
|
|
4321
|
-
* ```
|
|
4322
|
-
*/
|
|
4323
|
-
url: URL | null;
|
|
4324
|
-
/**
|
|
4325
|
-
* @private
|
|
4326
|
-
*/
|
|
4327
|
-
constructor();
|
|
4328
|
-
/**
|
|
4329
|
-
* The amount of free space available on the filesystem, in bytes.
|
|
4595
|
+
* Send a string message to the browser page.
|
|
4596
|
+
* The page receives it via `window.nx.onMessage`.
|
|
4597
|
+
* Requires `jsExtension: true` in the start options.
|
|
4330
4598
|
*/
|
|
4331
|
-
|
|
4332
|
-
/**
|
|
4333
|
-
* The total amount of space available on the filesystem, in bytes.
|
|
4334
|
-
*/
|
|
4335
|
-
totalSpace(): bigint;
|
|
4599
|
+
sendMessage(msg: string): boolean;
|
|
4336
4600
|
/**
|
|
4337
|
-
*
|
|
4338
|
-
*
|
|
4339
|
-
* @param name The name of the mount for filesystem paths. By default, a random name is generated. Should not exceed 31 characters, and should not have a trailing colon.
|
|
4601
|
+
* Request the browser to close gracefully.
|
|
4340
4602
|
*/
|
|
4341
|
-
|
|
4603
|
+
requestExit(): void;
|
|
4342
4604
|
/**
|
|
4343
|
-
*
|
|
4344
|
-
*
|
|
4345
|
-
* @example
|
|
4346
|
-
*
|
|
4347
|
-
* ```typescript
|
|
4348
|
-
* import { BisPartitionId } from '@nx.js/constants';
|
|
4349
|
-
*
|
|
4350
|
-
* // Open and mount the "User" partition
|
|
4351
|
-
* const fs = Switch.FileSystem.openBis(BisPartitionId.User);
|
|
4352
|
-
* const url = fs.mount();
|
|
4353
|
-
*
|
|
4354
|
-
* // Read the file entries at the root of the partition
|
|
4355
|
-
* console.log(Switch.readDirSync(url));
|
|
4356
|
-
* ```
|
|
4357
|
-
*
|
|
4358
|
-
* @param id The `BisPartitionId` of the partition to open.
|
|
4605
|
+
* Force close the browser and clean up.
|
|
4359
4606
|
*/
|
|
4360
|
-
|
|
4361
|
-
/**
|
|
4362
|
-
* Opens a file system partition for the SD card.
|
|
4363
|
-
*
|
|
4364
|
-
* Note that the SD card is automatically mounted under the `sdmc:` protocol,
|
|
4365
|
-
* so your application will not need to call this function under most circumstances.
|
|
4366
|
-
* However, it is useful for querying metatdata about the SD card, such as
|
|
4367
|
-
* the amount of free space available.
|
|
4368
|
-
*
|
|
4369
|
-
* @example
|
|
4370
|
-
*
|
|
4371
|
-
* ```typescript
|
|
4372
|
-
* const fs = Switch.FileSystem.openSdmc();
|
|
4373
|
-
* console.log(fs.freeSpace());
|
|
4374
|
-
* console.log(fs.totalSpace());
|
|
4375
|
-
* ```
|
|
4376
|
-
*/
|
|
4377
|
-
static openSdmc(): FileSystem;
|
|
4378
|
-
/**
|
|
4379
|
-
* Opens a file system partition for the application with the specified title ID.
|
|
4380
|
-
* The file system type is specified by the `FsFileSystemType` parameter.
|
|
4381
|
-
*
|
|
4382
|
-
* @example
|
|
4383
|
-
*
|
|
4384
|
-
* ```typescript
|
|
4385
|
-
* import { FsFileSystemType } from '@nx.js/constants';
|
|
4386
|
-
*
|
|
4387
|
-
* // Open and mount the "User" partition
|
|
4388
|
-
* const fs = Switch.FileSystem.openWithId(
|
|
4389
|
-
* 0x0100000000001000n,
|
|
4390
|
-
* FsFileSystemType.ContentMeta,
|
|
4391
|
-
* );
|
|
4392
|
-
* const url = fs.mount();
|
|
4393
|
-
*
|
|
4394
|
-
* // Read the file entries at the root of the file system
|
|
4395
|
-
* console.log(Switch.readDirSync(url));
|
|
4396
|
-
* ```
|
|
4397
|
-
*
|
|
4398
|
-
* @param titleId The title ID of the file system to open.
|
|
4399
|
-
* @param type The `FsFileSystemType` of the file system to open.
|
|
4400
|
-
* @param path The base path of the file system to open. Defaults to `/`.
|
|
4401
|
-
*/
|
|
4402
|
-
static openWithId(titleId: bigint, type: number, path?: string): FileSystem;
|
|
4403
|
-
}
|
|
4404
|
-
interface ServiceDispatchParams {
|
|
4405
|
-
targetSession?: number;
|
|
4406
|
-
context?: number;
|
|
4407
|
-
bufferAttrs?: number[];
|
|
4408
|
-
buffers?: BufferSource[];
|
|
4409
|
-
inSendPid?: boolean;
|
|
4410
|
-
inObjects?: Service[];
|
|
4411
|
-
inHandles?: number[];
|
|
4412
|
-
outObjects?: Service[];
|
|
4413
|
-
outHandleAttrs?: number[];
|
|
4414
|
-
outHandles?: number[];
|
|
4415
|
-
}
|
|
4416
|
-
declare class Service {
|
|
4417
|
-
constructor(name?: string);
|
|
4418
|
-
isActive(): void;
|
|
4419
|
-
isDomain(): void;
|
|
4420
|
-
isOverride(): void;
|
|
4421
|
-
dispatch(rid: number, params?: ServiceDispatchParams): void;
|
|
4422
|
-
dispatchIn(rid: number, inData: BufferSource, parmas?: ServiceDispatchParams): void;
|
|
4423
|
-
dispatchOut(rid: number, outData: BufferSource, params?: ServiceDispatchParams): void;
|
|
4424
|
-
dispatchInOut(rid: number, inData?: BufferSource, outData?: BufferSource, params?: ServiceDispatchParams): void;
|
|
4607
|
+
close(): void;
|
|
4425
4608
|
}
|
|
4426
4609
|
type PathLike = string | URL;
|
|
4427
4610
|
interface Versions {
|
|
@@ -4441,6 +4624,8 @@ declare namespace Switch {
|
|
|
4441
4624
|
readonly freetype2: string;
|
|
4442
4625
|
readonly harfbuzz: string;
|
|
4443
4626
|
readonly hos: string;
|
|
4627
|
+
readonly libnx: string;
|
|
4628
|
+
readonly mbedtls: string;
|
|
4444
4629
|
readonly nxjs: string;
|
|
4445
4630
|
readonly png: string;
|
|
4446
4631
|
readonly quickjs: string;
|
|
@@ -4542,6 +4727,17 @@ declare namespace Switch {
|
|
|
4542
4727
|
* This option is similar to that offered by the Node.js net module and allows interoperability with code which utilizes it.
|
|
4543
4728
|
*/
|
|
4544
4729
|
allowHalfOpen?: boolean;
|
|
4730
|
+
/**
|
|
4731
|
+
* When `true` (default), the TLS handshake will verify the server's
|
|
4732
|
+
* certificate against the system CA certificate store. Set to `false`
|
|
4733
|
+
* to disable certificate verification (e.g. for development/testing
|
|
4734
|
+
* with self-signed certificates).
|
|
4735
|
+
*
|
|
4736
|
+
* Only applicable when `secureTransport` is `'on'` or `'starttls'`.
|
|
4737
|
+
*
|
|
4738
|
+
* @default true
|
|
4739
|
+
*/
|
|
4740
|
+
rejectUnauthorized?: boolean;
|
|
4545
4741
|
}
|
|
4546
4742
|
interface SocketInfo {
|
|
4547
4743
|
remoteAddress: string;
|