.getIsBookmarked()
Checks whether the current page is bookmarked by the current reader.
The .getIsBookmarked()
method returns true
or false
to indicate whether the current page is bookmarked by the current reader.
This method should be called when a page loads and is useful to use with the .on()
method’s isBookmarkedChanged
event. You can then write code that reacts appropriately when the page is bookmarked. For more information, see the .on() method.
Warning
This method will returnnull
if the SDK has been initialized but Grow hasn’t finished loading the data for the page.
Syntax
window.growMe.getIsBookmarked()
Parameters
- None
Return Value(s)
true
The current page is bookmarked.false
The current page is not bookmarked.null
The SDK is initialized but Grow hasn’t finished loading information for the page.
Example(s)
The following example creates a variable to hold the Grow bookmarked status of the current page. The status is then updated whenever the user adds or removes the Grow bookmark.
// Creates a variable to hold the Grow bookmarked value.
let isBookmarked = window.growMe.getIsBookmarked();
// Creates a listener via the on() method that saves
// the Grow bookmarked status.
window.growMe.on("isBookmarkedChanged", (params) => {
isBookmarked = params.isBookmarked;
})