UNPKG

1.98 kBTypeScriptView Raw
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation. All rights reserved.
3Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4this file except in compliance with the License. You may obtain a copy of the
5License at http://www.apache.org/licenses/LICENSE-2.0
6
7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9WARRANTIES 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 permissions
13and limitations under the License.
14***************************************************************************** */
15
16
17
18/// <reference no-default-lib="true"/>
19
20
21interface ProxyHandler<T extends object> {
22 getPrototypeOf? (target: T): object | null;
23 setPrototypeOf? (target: T, v: any): boolean;
24 isExtensible? (target: T): boolean;
25 preventExtensions? (target: T): boolean;
26 getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor | undefined;
27 has? (target: T, p: PropertyKey): boolean;
28 get? (target: T, p: PropertyKey, receiver: any): any;
29 set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
30 deleteProperty? (target: T, p: PropertyKey): boolean;
31 defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean;
32 enumerate? (target: T): PropertyKey[];
33 ownKeys? (target: T): PropertyKey[];
34 apply? (target: T, thisArg: any, argArray?: any): any;
35 construct? (target: T, argArray: any, newTarget?: any): object;
36}
37
38interface ProxyConstructor {
39 revocable<T extends object>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
40 new <T extends object>(target: T, handler: ProxyHandler<T>): T;
41}
42declare var Proxy: ProxyConstructor;