bookmarks.getChildren()
retrieves all the immediate children of a given bookmark folder, identified as a
BookmarkTreeNode
ID.
This is an asynchronous function that returns a
Promise
.
var gettingChildren = browser.bookmarks.getChildren(
id
// string
)
id
A
string
which specifies the ID of the folder whose children are to be retrieved.
A
Promise
that will be fulfilled with an array of
BookmarkTreeNode
objects. Each entry represents a single child node. The list is ordered in the same order in which the bookmarks appear in the user interface. Separators are currently not included in the results. The list includes subfolders, but does not include any children contained in subfolders.
If the specified node has no children, the array is empty.
If the node identified by
id
is not found, the promise is rejected with an error message.
function onFulfilled(children) {
for
(
child
of
children
)
{
console
.
log
(
child
.
id
)
;
}
}
function
onRejected
(
error
)
{
console
.
log
(
`
An error:
${
error
}
`
)
;
}
var
gettingChildren
=
浏览器
.
bookmarks
.
getChildren
(
"unfiled_____"
)
;
gettingChildren
.
then
(
onFulfilled
,
onRejected
)
;
BCD tables only load in the browser
注意:
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.
最后修改: , 由 MDN 贡献者