From f6913b4918f6fb019f7bfa1aa2c614f5c0d3933e Mon Sep 17 00:00:00 2001 From: Ryan Blenis Date: Sat, 28 Dec 2019 06:55:09 -0500 Subject: [PATCH] Add 2 new hooks for detecting page changes in the webUI --- plugin_development.md | 2 ++ views/default.handlebars | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugin_development.md b/plugin_development.md index a3015873..17e6a890 100644 --- a/plugin_development.md +++ b/plugin_development.md @@ -63,6 +63,8 @@ These are separated into the following categories depending on the type of funct `registerPluginTab`: callable when a device is selected in the MeshCentral web interface to register a new tab for plugin data, if required. Accepts an object, or function that returns an object, with the following properties: { tabId: "yourShortNameHere", tabTitle: "Your Display Name"}. A tab and div with the associated ID and title will be created for your use `onDesktopDisconnect`: called when a remote desktop session is disconnected `onWebUIStartupEnd`: called when the page has loaded for the first time after a login / refresh +`goPageStart`: called before page changes take effect. Passes 2 arguments ( : int, : Event) +`goPageEnd`: called after page changes take effect. Passes 2 arguments ( : int, : Event) #### Exports Any function can be exported to the Web UI layer by adding the name of the function to an `exports` array in the plugin object. diff --git a/views/default.handlebars b/views/default.handlebars index d1e58137..2799b916 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -9834,6 +9834,7 @@ } function go(x, event) { + if (pluginHandler != null) pluginHandler.callHook('goPageStart', x, event); setSessionActivity(); if (xxdialogMode) return; QV('uiMenu', false); @@ -9959,6 +9960,7 @@ } else { document.title = decodeURIComponent('{{{extitle}}}'); } + if (pluginHandler != null) pluginHandler.callHook('goPageEnd', x, event); } //