Register a dynamic button which shows in the side toolbar
Dynamic buttons are buttons that only show when they are relevant
For more information read this excellent guide by Defman:
Methods
-
require("ko/dynamic-button").register(label, opts)
-
Register a new dynamic-button
Example
// All keys are optional, but realistically you should at least provide // command and isEnabled. opts = { id: "foo", tooltiptext: "tooltip", classList: "additional-class", command: function() {}, icon: "icon-name", label: "Foo!" ordinal: 1 menuitems: function() {} // function that returns menu items group: "fooGroup" // group this belongs to groupOrdinal: 1 isEnabled: function() {}, events: ["current_place_opened", "project_opened", "workspace_restored"] // what events to listen to for updating the isEnabled status }
Parameters:
Name Type Description label
String opts
Object Returns:
Dynamic Button Object
- Type
- dynamicButton
-
require("ko/dynamic-button").unregister(id)
-
Unregister a dynamic button
Parameters:
Name Type Description id
String The ID of the button, if no ID was given then the ID will be a fully textual version of the label (eg. "foo bar" becomes "foobar")
Returns:
- Type
- Void