buildfire.history
Breadcrumbs keep track of user navigation between different plugins and sections within a plugin. You can add to breadcrumbs inside your plugin to give the user the ability to navigate back to any breadcrumb you added.
Methods
push()
buildfire.history.push(label, options)
Whenever you drill down a level in your plugin and wish to reflect this in the breadcrumb simply use push to add to the breadcrumb history
buildfire.history.push("Log in");
label
Name | Type | Required | Description | Default |
---|---|---|---|---|
label | string | no | Breadcrumb label, can be used as title |
options
Options object where you can pass the data that is needed to take the user back to the view when breadcrumb is clicked (optional).
Name | Type | Required | Description | Default |
---|---|---|---|---|
showLabelInTitlebar | boolean | no | Shows label instead of plugin title in titlebar | false |
More Examples
buildfire.history.push("Profile", {
showLabelInTitlebar: true,
user: { name: "John Doe" },
id: 1234,
});
pop()
buildfire.history.pop()
Whenever you would want to go back one level in your own plugin breadcrumbs and wish to reflect this in the breadcrumb simply use pop to pop the latest breadcrumb in breadcrumb history.
You can only pop breadcrumbs added by your plugin.
buildfire.history.pop();
onPop()
buildfire.history.onPop(callback, allowMultipleHandlers)
Event that triggers whenever a breadcrumb is popped
buildfire.history.onPop((breadcrumb) => {
console.log("Breadcrumb popped", breadcrumb);
});
callback(breadcrumb)
Function that will get called on every event.
Name | Type | Description |
---|---|---|
breadcrumb | object | Breadcrumb object that was popped |
allowMultipleHandlers
Name | Type | Required | Description | Default |
---|---|---|---|---|
allowMultipleHandlers | boolean | no | Tells the method to override all other handlers | false |
get()
buildfire.history.get(options, callback)
Used to retrieve the list of all breadcrumbs
buildfire.history.get(
{
pluginBreadcrumbsOnly: true,
},
(err, result) => {
console.info("Current Plugin Breadcrumbs", result);
}
);
options
Function that will get called on every event.
Name | Type | Required | Description | Default |
---|---|---|---|---|
pluginBreadcrumbsOnly | boolean | no | Filter out to current plugin breadcrumbs if true | false |
callback(err, result)
Name | Type | Description |
---|---|---|
err | string | Error string, null when operation is successful |
result | [object] | Array of breadcrumb objects |