From 5a2b3f0c03d20048ca372d630af6ef06ab9838b4 Mon Sep 17 00:00:00 2001 From: Bennett Date: Mon, 9 Mar 2020 19:30:19 +0100 Subject: Add custom dark mode handler support (#445) * Add custom dark mode handler support * Fix lint --- src/webview/lib/RecipeWebview.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/webview/lib') diff --git a/src/webview/lib/RecipeWebview.js b/src/webview/lib/RecipeWebview.js index 1d24326c5..4fac21c55 100644 --- a/src/webview/lib/RecipeWebview.js +++ b/src/webview/lib/RecipeWebview.js @@ -19,6 +19,8 @@ class RecipeWebview { loopFunc = () => null; + darkModeHandler = false; + /** * Initialize the loop * @@ -80,6 +82,15 @@ class RecipeWebview { }); } + /** + * Set a custom handler for turning on and off dark mode + * + * @param {function} handler + */ + handleDarkMode(handler) { + this.darkModeHandler = handler; + } + onNotify(fn) { if (typeof fn === 'function') { window.Notification.prototype.onNotify = fn; -- cgit v1.2.3-70-g09d2