bookmarks.getRecent()
The bookmarks.getRecent()
method retrieves a specified number of the most recently added bookmarks as an array of BookmarkTreeNode
objects.
This is an asynchronous function that returns a Promise
.
Syntax
var gettingRecent = browser.bookmarks.getRecent(
numberOfItems // integer
)
Parameters
Return value
A Promise
that will be fulfilled with an array of BookmarkTreeNode
objects.
Examples
This example logs the URL for the most recently added bookmark:
function onFulfilled(bookmarks) {
for (bookmark of bookmarks) {
console.log(bookmark.url);
}
}
function onRejected(error) {
console.log(`An error: ${error}`);
}
var gettingRecent = browser.bookmarks.getRecent(1);
gettingRecent.then(onFulfilled, onRejected);
Browser compatibility
Report problems with this compatibility data on GitHubwebextensions-desktop | webextensions-mobile | |||||
---|---|---|---|---|---|---|
getRecent | ChromeFull supportYes | EdgeFull support79 | FirefoxFull support47 | OperaFull supportYes | SafariNo supportNo | Firefox for AndroidNo supportNo |
Legend
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Acknowledgements
This API is based on Chromium's chrome.bookmarks
API. This documentation is derived from bookmarks.json
in the Chromium code.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.