Add a short explanation of additional available callbacks

This commit is contained in:
Mark Walker 2015-04-28 04:24:59 -07:00
parent 4944c33228
commit 894aa9bc5e

View file

@ -169,6 +169,26 @@ onAfterTabChange
Called after the main tab view switches to a new tab, so `after` the new tab becomes visible. Called with the
current and previous tab's hash (e.g. ``#control``).
getAdditionalControls
Your viewmodel may return additional custom control definitions for inclusion on the "Control" tab of OctoPrint's
interface. See :ref:`the custom control feature<sec-features-custom_controls>`.
onSettingsShown
Called when the settings dialog is shown.
onSettingsHidden
Called when the settings dialog is hidden.
onSettingsBeforeSave
Called just before the settings viewmodel is sent to the server. This is useful, for example, if your plugin
needs to compute persisted settings from a custom viewmodel.
onUserSettingsShown
Called when the user settings dialog is shown.
onUserSettingsHidden
Called when the user settings dialog is hidden.
In order to hook into any of those callbacks, just have your viewmodel define a function named accordingly, e.g.
to get called after all viewmodels have been bound during application startup, implement a function ``onAllBound``
on your viewmodel, taking a list of all bound viewmodels:
@ -201,4 +221,4 @@ on your viewmodel, taking a list of all bound viewmodels:
OctoPrint's own viewmodels use the same mechanisms for interacting with each other and the web application as
plugins. Their sourcecode is therefore a good point of reference on how to achieve certain things.
`KnockoutJS documentation <http://knockoutjs.com/documentation/introduction.html>`_
OctoPrint makes heavy use of KnockoutJS for building up its web app.
OctoPrint makes heavy use of KnockoutJS for building up its web app.