massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-tsserver / node_modules / typescript / lib / lib.esnext.weakref.d.ts
1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
6
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
11
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
15
16
17
18 /// <reference no-default-lib="true"/>
19
20
21 interface WeakRef<T extends object> {
22     readonly [Symbol.toStringTag]: "WeakRef";
23
24     /**
25      * Returns the WeakRef instance's target object, or undefined if the target object has been
26      * reclaimed.
27      */
28     deref(): T | undefined;
29 }
30
31 interface WeakRefConstructor {
32     readonly prototype: WeakRef<any>;
33
34     /**
35      * Creates a WeakRef instance for the given target object.
36      * @param target The target object for the WeakRef instance.
37      */
38     new<T extends object>(target?: T): WeakRef<T>;
39 }
40
41 declare var WeakRef: WeakRefConstructor;
42
43 interface FinalizationRegistry {
44     readonly [Symbol.toStringTag]: "FinalizationRegistry";
45
46     /**
47      * Registers an object with the registry.
48      * @param target The target object to register.
49      * @param heldValue The value to pass to the finalizer for this object. This cannot be the
50      * target object.
51      * @param unregisterToken The token to pass to the unregister method to unregister the target
52      * object. If provided (and not undefined), this must be an object. If not provided, the target
53      * cannot be unregistered.
54      */
55     register(target: object, heldValue: any, unregisterToken?: object): void;
56
57     /**
58      * Unregisters an object from the registry.
59      * @param unregisterToken The token that was used as the unregisterToken argument when calling
60      * register to register the target object.
61      */
62     unregister(unregisterToken: object): void;
63 }
64
65 interface FinalizationRegistryConstructor {
66     readonly prototype: FinalizationRegistry;
67
68     /**
69      * Creates a finalization registry with an associated cleanup callback
70      * @param cleanupCallback The callback to call after an object in the registry has been reclaimed.
71      */
72     new(cleanupCallback: (heldValue: any) => void): FinalizationRegistry;
73 }
74
75 declare var FinalizationRegistry: FinalizationRegistryConstructor;