1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

LibWeb: Implement JS confirm()

This commit is contained in:
Nick Tiberi 2020-04-16 21:29:26 -04:00 committed by Andreas Kling
parent 0a483cf677
commit 1f6578ee0a
4 changed files with 20 additions and 0 deletions

View file

@ -52,6 +52,12 @@ void Window::alert(const String& message)
GUI::MessageBox::show(message, "Alert", GUI::MessageBox::Type::Information);
}
bool Window::confirm(const String& message)
{
auto confirm_result = GUI::MessageBox::show(message, "Confirm", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel);
return confirm_result == GUI::Dialog::ExecResult::ExecOK;
}
void Window::set_interval(JS::Function& callback, i32 interval)
{
// FIXME: This leaks the interval timer and makes it unstoppable.

View file

@ -43,6 +43,7 @@ public:
Document& document() { return m_document; }
void alert(const String&);
bool confirm(const String&);
i32 request_animation_frame(JS::Function&);
void cancel_animation_frame(i32);
void set_interval(JS::Function&, i32);