Skip to main content

Bookmarks

buildfire.bookmarks#

buildfire.bookmarks provides a simple way to allow users to save their favorite content for easy access. Saved bookmarks appear under the "bookmarks" section of the side menu.

Methods#

add()
#

buildfire.bookmarks.add(options, callback)

Adds a new bookmark

buildfire.bookmarks.add(
{
id: "BOOKMARK_ID",
title: "My Bookmark",
icon: "https://placekitten.com/32/32",
payload: {
data: { myData: "Hello World" },
},
},
(err, bookmark) => {
if (err) return console.error(err);
console.log("Bookmark ", bookmark);
}
);

options#

NameTypeRequiredDescriptionDefault
idstringnoUnique identifier
titlestringnoTitle of the item being bookmarked, will be displayed on the bookmarks page
iconstringnoIcon for the bookmarked item, will be displayed on the bookmarks page
payloadobjectnoCustom payload object that will be passed to plugin once its reached through bookmark

callback(err, bookmark)#

Callback after bookmark is created

NameTypeDescription
errstringerror string, null when operation is successfull
bookmarkobjectCreated bookmark
bookmark#
NameTypeDescription
idstringUnique identifier
titlestringBookmark title text
iconstringBookmark icon url
payloadobjectCustom payload object that will be passed to plugin once its reached through bookmark
pluginInstanceIdstringInstance id of the plugin bookmark was created from. This is the plugin that will be navigated to once the bookmark is clicked on bookmarks page

Consuming payload#

The payload is a serializable object that can be used to pass data back to the plugin. The app will navigate to the plugin to which the bookmark belongs, and this data is passed along through deeplinking.

To access the payload from the bookmark simply use buildfire.deeplink.getData()

buildfire.deeplink.getData((deeplinkData) => {
if (deeplinkData) console.log("Deep link data: ", deeplinkData);
});

delete()
#

buildfire.bookmarks.delete(bookmarkId, callback)

Deletes a bookmark

buildfire.bookmarks.delete("BOOKMARK_ID", () => {
console.log("Bookmark deleted successfully");
});

bookmarkId#

NameTypeRequiredDescriptionDefault
bookmarkIdstringyesUnique identifier of bookmark to be deleted

callback()#

Callback function after bookmark has been deleted


getAll()
#

buildfire.bookmarks.getAll(callback)

Gets all bookmarks for current plugin

buildfire.bookmarks.getAll((err, bookmarks) => {
if (err) return console.error(err);
console.log(bookmarks);
});

callback(err, bookmarks)#

Callback function after bookmarks are fetched

NameTypeDescription
errstringerror string, undefined when operation is successfull
bookmarks[object]Array of bookmark objects