• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16package escompat;
17
18/**
19 * A WeakMap is a collection of key/value pairs whose keys must be
20 * objects or non-registered symbols, with values of any arbitrary
21 * JavaScript type, and which does not create strong references to its
22 * keys.
23 */
24export final class WeakMap<K, V> {
25    /**
26     * The WeakMap() constructor creates WeakMap objects.
27     */
28    constructor() {
29
30    }
31
32    /**
33     * The set() method adds a new element with a specified key
34     * and value to a WeakMap object.
35     */
36    set(k: K, v: V): WeakMap<K, V> {
37        throw new Error("Not implemented");
38        return this;
39    }
40    /**
41     * The has() method returns a boolean indicating whether
42     * an element with the specified key exists in the WeakMap
43     * object or not.
44     */
45    has(k: K): boolean {
46        throw new Error("Not implemented");
47        return false;
48    }
49
50    /**
51     * The get() method returns a specified element from
52     * a WeakMap object.
53     */
54    get(k: K): V | null {
55        throw new Error("Not implemented");
56        return null;
57    }
58
59    /**
60     * The delete() method removes the specified element from
61     * a WeakMap object.
62     */
63    delete(k: K): boolean {
64        throw new Error("Not implemented");
65        return false;
66    }
67}
68