CoolFace
Apppublic

Pinsave/counterstrike

sourceHugging Faceupdated 3mo agoView on Hugging Face
1likes
lib.es2021.weakref.d.ts79 linesDownload Raw Back to lib
1/*! *****************************************************************************2Copyright (c) Microsoft Corporation. All rights reserved.3Licensed under the Apache License, Version 2.0 (the "License"); you may not use4this file except in compliance with the License. You may obtain a copy of the5License at http://www.apache.org/licenses/LICENSE-2.06 7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,10MERCHANTABLITY OR NON-INFRINGEMENT.11 12See the Apache Version 2.0 License for specific language governing permissions13and limitations under the License.14***************************************************************************** */15 16 17/// <reference no-default-lib="true"/>18 19/// <reference lib="es2015.symbol.wellknown" />20 21interface WeakRef<T extends WeakKey> {22    readonly [Symbol.toStringTag]: "WeakRef";23 24    /**25     * Returns the WeakRef instance's target value, or undefined if the target value has been26     * reclaimed.27     * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.28     */29    deref(): T | undefined;30}31 32interface WeakRefConstructor {33    readonly prototype: WeakRef<any>;34 35    /**36     * Creates a WeakRef instance for the given target value.37     * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.38     * @param target The target value for the WeakRef instance.39     */40    new <T extends WeakKey>(target: T): WeakRef<T>;41}42 43declare var WeakRef: WeakRefConstructor;44 45interface FinalizationRegistry<T> {46    readonly [Symbol.toStringTag]: "FinalizationRegistry";47 48    /**49     * Registers a value with the registry.50     * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.51     * @param target The target value to register.52     * @param heldValue The value to pass to the finalizer for this value. This cannot be the53     * target value.54     * @param unregisterToken The token to pass to the unregister method to unregister the target55     * value. If not provided, the target cannot be unregistered.56     */57    register(target: WeakKey, heldValue: T, unregisterToken?: WeakKey): void;58 59    /**60     * Unregisters a value from the registry.61     * In es2023 the value can be either a symbol or an object, in previous versions only object is permissible.62     * @param unregisterToken The token that was used as the unregisterToken argument when calling63     * register to register the target value.64     */65    unregister(unregisterToken: WeakKey): boolean;66}67 68interface FinalizationRegistryConstructor {69    readonly prototype: FinalizationRegistry<any>;70 71    /**72     * Creates a finalization registry with an associated cleanup callback73     * @param cleanupCallback The callback to call after a value in the registry has been reclaimed.74     */75    new <T>(cleanupCallback: (heldValue: T) => void): FinalizationRegistry<T>;76}77 78declare var FinalizationRegistry: FinalizationRegistryConstructor;79