ladybird/Userland/Libraries/LibWeb/DOM/DocumentObserver.h
Timothy Flynn f78eadf00f LibWeb: Add an interface to be notified of Document state changes
Some HTML elements, e.g. HTMLMediaElement, need to take action when the
document becomes inactive.
2023-05-04 16:48:10 +02:00

32 lines
696 B
C++

/*
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Forward.h>
#include <LibJS/SafeFunction.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Forward.h>
namespace Web::DOM {
class DocumentObserver final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DocumentObserver, Bindings::PlatformObject);
public:
JS::SafeFunction<void()> document_became_inactive;
private:
explicit DocumentObserver(JS::Realm&, DOM::Document&);
virtual void visit_edges(Cell::Visitor&) override;
virtual void finalize() override;
JS::NonnullGCPtr<DOM::Document> m_document;
};
}