/* * Copyright (c) 2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Web::HTML { class Storage : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(Storage, Bindings::PlatformObject); public: static JS::NonnullGCPtr create(JS::Realm&); ~Storage(); size_t length() const; DeprecatedString key(size_t index); DeprecatedString get_item(DeprecatedString const& key) const; WebIDL::ExceptionOr set_item(DeprecatedString const& key, DeprecatedString const& value); void remove_item(DeprecatedString const& key); void clear(); Vector supported_property_names() const; auto const& map() const { return m_map; } void dump() const; private: explicit Storage(JS::Realm&); void reorder(); void broadcast(DeprecatedString const& key, DeprecatedString const& old_value, DeprecatedString const& new_value); OrderedHashMap m_map; }; }