/* * Copyright (c) 2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::HTML { class Storage : public RefCounted , public Bindings::Wrappable { public: using WrapperType = Bindings::StorageWrapper; static NonnullRefPtr create(); ~Storage(); size_t length() const; String key(size_t index); String get_item(String const& key) const; DOM::ExceptionOr set_item(String const& key, String const& value); void remove_item(String const& key); void clear(); Vector supported_property_names() const; auto const& map() const { return m_map; } void dump() const; private: Storage(); void reorder(); void broadcast(String const& key, String const& old_value, String const& new_value); OrderedHashMap m_map; }; } namespace Web::Bindings { StorageWrapper* wrap(JS::GlobalObject&, HTML::Storage&); }