mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:47:45 +00:00
LibJS: Add the WeakSet built-in object
This commit is contained in:
parent
ee9fe288b2
commit
8b6beac5ce
10 changed files with 250 additions and 1 deletions
31
Userland/Libraries/LibJS/Runtime/WeakSet.h
Normal file
31
Userland/Libraries/LibJS/Runtime/WeakSet.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/HashTable.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class WeakSet : public Object {
|
||||
JS_OBJECT(WeakSet, Object);
|
||||
|
||||
public:
|
||||
static WeakSet* create(GlobalObject&);
|
||||
|
||||
explicit WeakSet(Object& prototype);
|
||||
virtual ~WeakSet() override;
|
||||
|
||||
HashTable<Object*> const& values() const { return m_values; };
|
||||
HashTable<Object*>& values() { return m_values; };
|
||||
|
||||
private:
|
||||
HashTable<Object*> m_values;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue