# 书签
## 内容
1. [介绍](bookmarks.html#manifest)
2. [对象和属性](bookmarks.html#description)
3. [例子](bookmarks.html#overview-examples)
4. [API 参考:chrome.bookmarks](bookmarks.html#apiReference)
1. [方法](bookmarks.html#methods)
1. [create](bookmarks.html#method-create)
2. [get](bookmarks.html#method-get)
3. [getChildren](bookmarks.html#method-getChildren)
4. [getRecent](bookmarks.html#method-getRecent)
5. [getTree](bookmarks.html#method-getTree)
6. [move](bookmarks.html#method-move)
7. [remove](bookmarks.html#method-remove)
8. [removeTree](bookmarks.html#method-removeTree)
9. [search](bookmarks.html#method-search)
10. [update](bookmarks.html#method-update)
2. [事件](bookmarks.html#events)
1. [onChanged](bookmarks.html#event-onChanged)
2. [onChildrenReordered](bookmarks.html#event-onChildrenReordered)
3. [onCreated](bookmarks.html#event-onCreated)
4. [onImportBegan](bookmarks.html#event-onImportBegan)
5. [onImportEnded](bookmarks.html#event-onImportEnded)
6. [onMoved](bookmarks.html#event-onMoved)
7. [onRemoved](bookmarks.html#event-onRemoved)
3. [类型](bookmarks.html#types)
1. [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode)
使用chrome.bookmarks模块来创建、组织和管理书签。也可参看 [Override Pages](override.html),来创建一个可定制的书签管理器页面。
![Clicking the star adds a bookmark](https://box.kancloud.cn/2015-12-28_5680ab0272a43.png)
## 介绍
您必须在扩展说明文件中声明使用书签API的权限。例如:
```
{
"name": "My extension",
...
**"permissions": [
"bookmarks"
]**,
...
}
```
## 对象和属性
书签是按照树状结构组织的,每个节点都是一个书签或者一组节点(每个书签夹可包含多个节点)。每个节点都对应一个 [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) 对象。
可以通过 chrome.bookmarks API来使用BookmarkTreeNode的属性。例如,当调用函数 [create()](bookmarks.html#method-create),可以传入参数新节点的父节点(父节点ID),以及可选的节点索引,标题和url属性。可参看 [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) 来获取节点的信息。
## 例子
下面的 代码创建了一个标题为 "Extension bookmarks"的书签夹。函数create()的第一个参数指定了新书签夹的属性,第二个参数定义了一个在书签夹创建后要执行的回调函数
```
chrome.bookmarks.create({'parentId': bookmarkBar.id,
'title': 'Extension bookmarks'},
function(newFolder) {
console.log("added folder: " + newFolder.title);
});
```
接下来的代码创建了一个指向扩展开发文档的书签。如果创建书签失败,也不会引起什么问题,所以没有指定回调函数。
```
chrome.bookmarks.create({'parentId': extensionsFolderId,
'title': 'Extensions doc',
'url': 'http://code.google.com/chrome/extensions'});
```
使用该API的实例请参看 [basic bookmarks sample](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/bookmarks/basic/)。其他例子和源码请参看 [Samples](samples.html)。
## API 参考:chrome.bookmarks
### Properties
<a></a>
#### getLastError
chrome.extensionlastError
### 方法
#### create
void chrome.bookmarks.create(, object `bookmark`, function `callback`)
Undocumented.
在指定父节点下创建一个书签或者书签夹。如果url为空,则创建一个书签夹。
#### 参数
`bookmark`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`parentId` 父节点ID_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`title`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
The callback _parameter_ should specify a function that looks like this:
如果需要指定回调函数,则回调函数格式如下:
```
function(BookmarkTreeNode result) {...};
```
`result`_( optional enumerated [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
<a></a>
#### method name
void chrome.module.methodName(, ``)
Undocumented.
A description from the json schema def of the function goes here.
#### Parameters
#### Returns
#### Callback function
The callback _parameter_ should specify a function that looks like this:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(Type param1, Type param2) {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### get
void chrome.bookmarks.get(, string or array of string `idOrIdList`, function `callback`)
Undocumented.
获取指定的书签节点。
#### 参数
`idOrIdList`_( optional enumerated Type array of string or array of string )_
Undocumented.
一个字符串类型的Id,或者字符串数组
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
如果需要指定回调函数,则回调函数格式如下:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(array of BookmarkTreeNode results) {...};
```
`results`_( optional enumerated Type array of [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### getChildren
void chrome.bookmarks.getChildren(, string `id`, function `callback`)
Undocumented.
获取指定的书签节点的子节点
#### 参数
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
如果需要指定回调函数,则回调函数格式如下:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(array of BookmarkTreeNode results) {...};
```
`results`_( optional enumerated Type array of [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### getRecent
void chrome.bookmarks.getRecent(, integer `numberOfItems`, function `callback`)
Undocumented.
获取最近添加的书签。
#### Parameters
`numberOfItems`_( optional enumerated Type array of integer )_
Undocumented.
最多返回的条目数量。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
如果需要指定回调函数,则回调函数格式如下:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(array of BookmarkTreeNode results) {...};
```
`results`_( optional enumerated Type array of [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### getTree
void chrome.bookmarks.getTree(, function `callback`)
Undocumented.
按照层次结构获取所有书签。
#### Parameters
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
回调参数 _parameter_ 指定的回调函数如下:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(array of BookmarkTreeNode results) {...};
```
`results`_( optional enumerated Type array of [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
<a></a>
#### method name
void chrome.module.methodName(, ``)
Undocumented.
A description from the json schema def of the function goes here.
#### Parameters
#### Returns
#### Callback function
The callback _parameter_ should specify a function that looks like this:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(Type param1, Type param2) {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### move
void chrome.bookmarks.move(, string `id`, object `destination`, function `callback`)
Undocumented.
移动指定的书签节点到指定的位置。
#### Parameters
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`destination`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`parentId`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
如果需要指定_callback_参数,函数格式如下:
```
function(BookmarkTreeNode result) {...};
```
`result`_( optional enumerated [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### remove
void chrome.bookmarks.remove(, string `id`, function `callback`)
Undocumented.
删除一个书签或者空书签夹。
#### Parameters
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
如果需要指定_callback_参数,函数格式如下:
```
function() {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### removeTree
void chrome.bookmarks.removeTree(, string `id`, function `callback`)
Undocumented.
删除书签夹目录(和它的子目录)。
#### 参数
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
如果需要指定_callback_参数,函数格式如下:
```
function() {...};
```
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### search
void chrome.bookmarks.search(, string `query`, function `callback`)
Undocumented.
根据指定查询条件搜索书签节点。
#### 参数
`query`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
回调函数格式如下:
If you specify the _callback_ parameter, it should specify a function that looks like this:
```
function(array of BookmarkTreeNode results) {...};
```
`results`_( optional enumerated Type array of [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### update
void chrome.bookmarks.update(, string `id`, object `changes`, function `callback`)
Undocumented.
更新书签或者书签夹的属性。指定需要改变的属性;未指定的属性将不会被改变。**注意:** 近期只支持 'title'和 'url'。
#### 参数
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`changes`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`title`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`callback`_( optional enumerated Type array of function )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### Returns
#### 回调函数
如果需要指定callback参数,函数格式如下:
```
function(BookmarkTreeNode result) {...};
```
`result`_( optional enumerated [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
This function was added in version . If you require this function, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
### 事件
#### onChanged
chrome.bookmarks.onChanged.addListener(function(string id, object changeInfo) {...});
Undocumented.
当书签或者书签夹发生改变时触发该事件。**注意:** 近期只有标题和url发生改变时,才触发该事件。
#### 参数
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`changeInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`title`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onChildrenReordered
chrome.bookmarks.onChildrenReordered.addListener(function(string id, object reorderInfo) {...});
Undocumented.
由于UI中的顺序发生改变时,书签夹会改变其子节点的顺序,此时会触发该事件。函数 move()不会触发该事件。
#### Parameters
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`reorderInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`childIds`_( optional enumerated Type array of Type array of string paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onCreated
chrome.bookmarks.onCreated.addListener(function(string id, BookmarkTreeNode bookmark) {...});
Undocumented.
当创建书签或者书签夹夹时,会触发该事件。
#### 参数
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`bookmark`_( optional enumerated [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onImportBegan
chrome.bookmarks.onImportBegan.addListener(function() {...});
Undocumented.
当开始导入书签时,会触发该事件 。事件响应者在导入结束前不要处理标签创建、更新的事件。但仍然可以立即处理其他事件。
#### Parameters
#### onImportEnded
chrome.bookmarks.onImportEnded.addListener(function() {...});
Undocumented.
当导入书签结束时,会触发该事件 。
#### Parameters
#### onMoved
chrome.bookmarks.onMoved.addListener(function(string id, object moveInfo) {...});
Undocumented.
当书签或者书签夹被移动到其他父书签夹时,触发该事件。
#### 参数
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`moveInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`parentId`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`oldParentId`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`oldIndex`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
#### onRemoved
chrome.bookmarks.onRemoved.addListener(function(string id, object removeInfo) {...});
Undocumented.
当书签和书签夹被删除时,触发该事件。当递归删除书签夹时,只会触发一个节点删除事件,它的子节点不会触发节点删除事件。
#### 参数
`id`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`removeInfo`_( optional enumerated Type array of object )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`parentId`_( optional enumerated Type array of string )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
### Types
#### BookmarkTreeNode
`paramName`_( optional enumerated Type array of object )_
Undocumented.
这个节点对象代表一个书签或者一个书签目录项。 节点对象有父子关系。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`id`_( optional enumerated Type array of string )_
Undocumented.
节点的唯一标识。IDs 在当前配置文件中是唯一的,浏览器重启后依然有效。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`parentId`_( optional enumerated Type array of string )_
Undocumented.
父节点的ID。根节点没有父节点。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`index`_( optional enumerated Type array of integer )_
Undocumented.
在父节点的书签夹范围内,该节点的索引,从0开始。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`url`_( optional enumerated Type array of string )_
Undocumented.
当用户点击书签时,浏览器访问的url。书签夹没有该属性 。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`title`_( optional enumerated Type array of string )_
Undocumented.
节点的说明文字。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`dateAdded`_( optional enumerated Type array of number )_
Undocumented.
节点创建时距纪元时间的毫秒数。 (`new Date(dateAdded)`).
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`dateGroupModified`_( optional enumerated Type array of number )_
Undocumented.
书签夹内容的最后更新时间距纪元时间的毫秒数。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
`children`_( optional enumerated Type array of [BookmarkTreeNode](bookmarks.html#type-BookmarkTreeNode) array of paramType paramType )_
Undocumented.
节点的孩子的有序列表。
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key [minimum_chrome_version](manifest.html#minimum_chrome_version) can ensure that your extension won't be run in an earlier browser version.
- 基础文档
- 综述
- 调试
- 格式:Manifest文件
- 模式匹配
- 改变浏览器外观
- Browser Actions
- Context Menus
- 桌面通知
- Omnibox
- Override替代页
- Page Actions
- 主题
- 与浏览器交互
- 书签
- Cookies
- chrome.devtools.* APIs
- Events
- chrome.history
- Management
- 标签
- 视窗
- 实现扩展
- 无障碍性(a11y)
- 背景页
- Content Scripts
- 跨域 XMLHttpRequest 请求
- 国际化 (i18n)
- 消息传递
- Optional Permissions
- NPAPI 插件
- 完成并发布应用
- 自动升级
- 托管
- 打包
- 规范和协议
- 应用设计规范
- 开发人员协议
- 免责声明