diff options
author | Nick Tiberi <nicktiberi@gmail.com> | 2020-04-16 21:29:26 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-17 13:41:03 +0200 |
commit | 1f6578ee0a52e8302a1c485448b2e1736506ffec (patch) | |
tree | be2d1d1dc3a002283f22d0a672a0c954eafc42e3 /Libraries/LibWeb/DOM/Window.cpp | |
parent | 0a483cf6774bcac0a7435bc217fd81342205d225 (diff) | |
download | serenity-1f6578ee0a52e8302a1c485448b2e1736506ffec.zip |
LibWeb: Implement JS confirm()
Diffstat (limited to 'Libraries/LibWeb/DOM/Window.cpp')
-rw-r--r-- | Libraries/LibWeb/DOM/Window.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibWeb/DOM/Window.cpp b/Libraries/LibWeb/DOM/Window.cpp index a70aa35b3d..f5f48e2a5b 100644 --- a/Libraries/LibWeb/DOM/Window.cpp +++ b/Libraries/LibWeb/DOM/Window.cpp @@ -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. |