### Listen for Import Start Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark import session begins. Expensive observers should defer onCreated updates until onImportEnded. ```javascript chrome.bookmarks.onImportBegan.addListener( callback: function, ) ``` ```javascript () => void ``` -------------------------------- ### chrome.bookmarks.getSubTree() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves part of the Bookmarks hierarchy, starting at the specified node. ```APIDOC ## chrome.bookmarks.getSubTree() ### Description Retrieves part of the Bookmarks hierarchy, starting at the specified node. ### Parameters #### id string The ID of the root of the subtree to retrieve. ### Returns * Promise Chrome 90+ ``` -------------------------------- ### Listen for Bookmark Creation Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder is created. Use this to track newly added items. ```javascript chrome.bookmarks.onCreated.addListener( callback: function, ) ``` ```javascript (id: string, bookmark: BookmarkTreeNode) => void ``` -------------------------------- ### Create a Bookmark Folder Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Creates a new folder for bookmarks. The first argument specifies properties for the new folder, and the second argument is a callback function executed after creation. ```javascript chrome.bookmarks.create( {'parentId': bookmarkBar.id, 'title': 'Extension bookmarks'}, function(newFolder) { console.log("added folder: " + newFolder.title); } ); ``` -------------------------------- ### Create Folder Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Creates a new folder for bookmarks. The first argument specifies properties for the new folder, and the second argument is a callback function executed after creation. ```APIDOC ## chrome.bookmarks.create (folder) ### Description Creates a new folder to organize bookmarks. ### Method chrome.bookmarks.create ### Parameters - `properties` (object) - Required - An object containing properties for the new folder, such as `parentId` and `title`. - `parentId` (string) - The ID of the parent folder where the new folder will be created. - `title` (string) - The title of the new folder. - `callback` (function) - Optional - A function to be executed after the folder is created. It receives the newly created folder object as an argument. ### Request Example ```javascript chrome.bookmarks.create({ 'parentId': bookmarkBar.id, 'title': 'Extension bookmarks' }, function(newFolder) { console.log("added folder: " + newFolder.title); }); ``` ``` -------------------------------- ### chrome.bookmarks.create() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Creates a bookmark or a folder. If the URL is provided, it creates a bookmark. If the URL is omitted, it creates a folder. ```APIDOC ## chrome.bookmarks.create() ### Description Creates a bookmark or a folder. ### Method Signature `chrome.bookmarks.create(properties, callback)` ### Parameters * `properties` (object) - An object with properties for the new bookmark or folder. See `bookmark.CreateDetails`. * `callback` (function) - Called with the `BookmarkTreeNode` representing the created item. ``` -------------------------------- ### chrome.bookmarks.create() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder. ```APIDOC ## chrome.bookmarks.create() ### Description Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder. ### Parameters #### bookmark CreateDetails ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.onCreated.addListener Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder is created. ```APIDOC ## chrome.bookmarks.onCreated.addListener ### Description Fired when a bookmark or folder is created. ### Method chrome.bookmarks.onCreated.addListener ### Parameters #### Callback Function - **callback** (function) - Required - The function to call when the event is fired. - **id** (string) - The ID of the created bookmark or folder. - **bookmark** (BookmarkTreeNode) - The created bookmark or folder object. ``` -------------------------------- ### Listen for Bookmark Moves Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder is moved to a different parent folder. Use this to track structural changes. ```javascript chrome.bookmarks.onMoved.addListener( callback: function, ) ``` ```javascript (id: string, moveInfo: object) => void ``` -------------------------------- ### Create a Bookmark Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Creates a new bookmark pointing to a specified URL. A callback function is optional if no critical action depends on the creation's success. ```javascript chrome.bookmarks.create({ 'parentId': extensionsFolderId, 'title': 'Extensions doc', 'url': 'https://developer.chrome.com/docs/extensions' }); ``` -------------------------------- ### Create Bookmark Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Creates a new bookmark. This function can optionally take a callback function to handle the result of the creation. ```APIDOC ## chrome.bookmarks.create (bookmark) ### Description Creates a new bookmark. ### Method chrome.bookmarks.create ### Parameters - `properties` (object) - Required - An object containing properties for the new bookmark, such as `parentId`, `title`, and `url`. - `parentId` (string) - The ID of the parent folder where the new bookmark will be created. - `title` (string) - The title of the bookmark. - `url` (string) - The URL the bookmark points to. - `callback` (function) - Optional - A function to be executed after the bookmark is created. ### Request Example ```javascript chrome.bookmarks.create({ 'parentId': extensionsFolderId, 'title': 'Extensions doc', 'url': 'https://developer.chrome.com/docs/extensions' }); ``` ``` -------------------------------- ### Listen for Bookmark Changes Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder changes, specifically title and URL. Use this to react to modifications in bookmark data. ```javascript chrome.bookmarks.onChanged.addListener( callback: function, ) ``` ```javascript (id: string, changeInfo: object) => void ``` -------------------------------- ### Listen for Import End Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark import session ends. This signals that onCreated events can be processed normally again. ```javascript chrome.bookmarks.onImportEnded.addListener( callback: function, ) ``` ```javascript () => void ``` -------------------------------- ### Listen for Bookmark Removal Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder is removed. A single notification is fired for a recursively removed folder. ```javascript chrome.bookmarks.onRemoved.addListener( callback: function, ) ``` ```javascript (id: string, removeInfo: object) => void ``` -------------------------------- ### chrome.bookmarks.onImportBegan.addListener Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. ```APIDOC ## chrome.bookmarks.onImportBegan.addListener ### Description Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. ### Method chrome.bookmarks.onImportBegan.addListener ### Parameters #### Callback Function - **callback** (function) - Required - The function to call when the event is fired. This callback takes no arguments. ``` -------------------------------- ### chrome.bookmarks.getTree() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves the entire bookmark tree. ```APIDOC ## chrome.bookmarks.getTree() ### Description Retrieves the entire bookmark tree. ### Method Signature `chrome.bookmarks.getTree(callback)` ### Parameters * `callback` (function) - Called with an array of `BookmarkTreeNode` objects representing the root nodes of the bookmark tree. ``` -------------------------------- ### chrome.bookmarks.get() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves all bookmark tree nodes that match the given query. ```APIDOC ## chrome.bookmarks.get() ### Description Retrieves all bookmark tree nodes that match the given query. ### Method Signature `chrome.bookmarks.get(idOrUrl, callback)` ### Parameters * `idOrUrl` (string or array of strings) - The ID or URL of the bookmark to retrieve. If omitted, all bookmarks are returned. * `callback` (function) - Called with an array of `BookmarkTreeNode` objects. ``` -------------------------------- ### chrome.bookmarks.onMoved.addListener Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder is moved to a different parent folder. ```APIDOC ## chrome.bookmarks.onMoved.addListener ### Description Fired when a bookmark or folder is moved to a different parent folder. ### Method chrome.bookmarks.onMoved.addListener ### Parameters #### Callback Function - **callback** (function) - Required - The function to call when the event is fired. - **id** (string) - The ID of the moved bookmark or folder. - **moveInfo** (object) - An object containing move information. - **index** (number) - The new index of the item within its new parent. - **oldIndex** (number) - The old index of the item within its old parent. - **oldParentId** (string) - The ID of the old parent folder. - **parentId** (string) - The ID of the new parent folder. ``` -------------------------------- ### chrome.bookmarks.getTree() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves the entire Bookmarks hierarchy. ```APIDOC ## chrome.bookmarks.getTree() ### Description Retrieves the entire Bookmarks hierarchy. ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.onImportEnded.addListener Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark import session is ended. ```APIDOC ## chrome.bookmarks.onImportEnded.addListener ### Description Fired when a bookmark import session is ended. ### Method chrome.bookmarks.onImportEnded.addListener ### Parameters #### Callback Function - **callback** (function) - Required - The function to call when the event is fired. This callback takes no arguments. ``` -------------------------------- ### chrome.bookmarks.get() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves the specified BookmarkTreeNode(s). ```APIDOC ## chrome.bookmarks.get() ### Description Retrieves the specified BookmarkTreeNode(s). ### Parameters #### idOrIdList string | [string, ...string[]] A single string-valued id, or an array of string-valued ids ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.move() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Moves a bookmark or a folder to a different location in the bookmark tree. ```APIDOC ## chrome.bookmarks.move() ### Description Moves a bookmark or a folder to a different location in the bookmark tree. ### Method Signature `chrome.bookmarks.move(id, destination, callback)` ### Parameters * `id` (string) - The ID of the bookmark or folder to move. * `destination` (object) - An object specifying the destination. It must contain either `parentId` or `index`. * `callback` (function) - Called with the `BookmarkTreeNode` representing the moved item. ``` -------------------------------- ### chrome.bookmarks.search() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. ```APIDOC ## chrome.bookmarks.search() ### Description Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. ### Parameters #### query string | object Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties `query`, `url`, and `title` may be specified and bookmarks matching all specified properties will be produced. * query string optional A string of words and quoted phrases that are matched against bookmark URLs and titles. * title string optional The title of the bookmark; matches verbatim. * url string optional The URL of the bookmark; matches verbatim. Note that folders have no URL. ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.getSubTree() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves a specific subtree of the bookmark tree. ```APIDOC ## chrome.bookmarks.getSubTree() ### Description Retrieves a specific subtree of the bookmark tree. ### Method Signature `chrome.bookmarks.getSubTree(id, callback)` ### Parameters * `id` (string) - The ID of the root node of the subtree to retrieve. * `callback` (function) - Called with an array containing a single `BookmarkTreeNode` representing the root of the requested subtree. ``` -------------------------------- ### chrome.bookmarks.update() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Updates the properties of a bookmark or folder. ```APIDOC ## chrome.bookmarks.update() ### Description Updates the properties of a bookmark or folder. ### Method Signature `chrome.bookmarks.update(id, changes, callback)` ### Parameters * `id` (string) - The ID of the bookmark or folder to update. * `changes` (object) - An object containing the properties to change. Can include `title`, `url`, `parentId`, or `index`. * `callback` (function) - Called with the `BookmarkTreeNode` representing the updated item. ``` -------------------------------- ### Declare Bookmarks Permission in Manifest Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks You must declare the 'bookmarks' permission in the extension manifest to use the bookmarks API. ```json { "name": "My extension", ... "permissions": [ "bookmarks" ], ... } ``` -------------------------------- ### chrome.bookmarks.update() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. ```APIDOC ## chrome.bookmarks.update() ### Description Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. **Note:** Currently, only 'title' and 'url' are supported. ### Parameters #### id string #### changes object * title string optional * url string optional ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.search() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Searches for bookmarks that match the given query. ```APIDOC ## chrome.bookmarks.search() ### Description Searches for bookmarks that match the given query. ### Method Signature `chrome.bookmarks.search(searchInfo, callback)` ### Parameters * `searchInfo` (string or object) - A string to search for in titles and URLs, or an object with `query` and `startTime`/`endTime` properties. * `callback` (function) - Called with an array of `BookmarkTreeNode` objects that match the search criteria. ``` -------------------------------- ### chrome.bookmarks.move() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Moves the specified BookmarkTreeNode to the provided location. ```APIDOC ## chrome.bookmarks.move() ### Description Moves the specified BookmarkTreeNode to the provided location. ### Parameters #### id string #### destination object * index number optional * parentId string optional ### Returns * Promise Chrome 90+ ``` -------------------------------- ### Listen for Children Reordering Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when the children of a folder change their order. This event is not triggered by the move() function. ```javascript chrome.bookmarks.onChildrenReordered.addListener( callback: function, ) ``` ```javascript (id: string, reorderInfo: object) => void ``` -------------------------------- ### chrome.bookmarks.getChildren() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves a list of all children of a given bookmark tree node. ```APIDOC ## chrome.bookmarks.getChildren() ### Description Retrieves a list of all children of a given bookmark tree node. ### Method Signature `chrome.bookmarks.getChildren(id, callback)` ### Parameters * `id` (string) - The ID of the parent bookmark tree node. * `callback` (function) - Called with an array of `BookmarkTreeNode` objects representing the children. ``` -------------------------------- ### chrome.bookmarks.onChanged.addListener Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder changes. Currently, only title and url changes trigger this event. ```APIDOC ## chrome.bookmarks.onChanged.addListener ### Description Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. ### Method chrome.bookmarks.onChanged.addListener ### Parameters #### Callback Function - **callback** (function) - Required - The function to call when the event is fired. - **id** (string) - The ID of the changed bookmark or folder. - **changeInfo** (object) - An object containing information about the change. - **title** (string) - The new title of the bookmark or folder, if changed. - **url** (string) - The new URL of the bookmark, if changed. ``` -------------------------------- ### chrome.bookmarks.getRecent() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves the recently added bookmarks. ```APIDOC ## chrome.bookmarks.getRecent() ### Description Retrieves the recently added bookmarks. ### Parameters #### numberOfItems number The maximum number of items to return. ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.onChildrenReordered.addListener Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). ```APIDOC ## chrome.bookmarks.onChildrenReordered.addListener ### Description Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). ### Method chrome.bookmarks.onChildrenReordered.addListener ### Parameters #### Callback Function - **callback** (function) - Required - The function to call when the event is fired. - **id** (string) - The ID of the folder whose children were reordered. - **reorderInfo** (object) - An object containing reorder information. - **childIds** (string[]) - An array of the IDs of the children in their new order. ``` -------------------------------- ### chrome.bookmarks.getRecent() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves a list of recently added bookmarks. ```APIDOC ## chrome.bookmarks.getRecent() ### Description Retrieves a list of recently added bookmarks. ### Method Signature `chrome.bookmarks.getRecent(numberOfItems, callback)` ### Parameters * `numberOfItems` (integer) - The maximum number of recent bookmarks to return. * `callback` (function) - Called with an array of `BookmarkTreeNode` objects representing the recent bookmarks. ``` -------------------------------- ### chrome.bookmarks.getChildren() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Retrieves the children of the specified BookmarkTreeNode id. ```APIDOC ## chrome.bookmarks.getChildren() ### Description Retrieves the children of the specified BookmarkTreeNode id. ### Parameters #### id string ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.removeTree() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Recursively removes a bookmark folder. ```APIDOC ## chrome.bookmarks.removeTree() ### Description Recursively removes a bookmark folder. ### Parameters #### id string ### Returns * Promise Chrome 90+ ``` -------------------------------- ### chrome.bookmarks.remove() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Removes a bookmark or a folder. ```APIDOC ## chrome.bookmarks.remove() ### Description Removes a bookmark or a folder. ### Method Signature `chrome.bookmarks.remove(id, callback)` ### Parameters * `id` (string) - The ID of the bookmark or folder to remove. * `callback` (function) - Called when the removal is complete. ``` -------------------------------- ### chrome.bookmarks.removeTree() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Removes a bookmark folder and all its contents. ```APIDOC ## chrome.bookmarks.removeTree() ### Description Removes a bookmark folder and all its contents. ### Method Signature `chrome.bookmarks.removeTree(id, callback)` ### Parameters * `id` (string) - The ID of the bookmark folder to remove. * `callback` (function) - Called when the removal is complete. ``` -------------------------------- ### chrome.bookmarks.onRemoved.addListener Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. ```APIDOC ## chrome.bookmarks.onRemoved.addListener ### Description Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. ### Method chrome.bookmarks.onRemoved.addListener ### Parameters #### Callback Function - **callback** (function) - Required - The function to call when the event is fired. - **id** (string) - The ID of the removed bookmark or folder. - **removeInfo** (object) - An object containing removal information. - **index** (number) - The index of the item within its parent at the time of removal. - **node** (BookmarkTreeNode) - The removed bookmark or folder object. (Chrome 48+) - **parentId** (string) - The ID of the parent folder from which the item was removed. ``` -------------------------------- ### chrome.bookmarks.remove() Source: https://developer.chrome.com/docs/extensions/reference/api/bookmarks Removes a bookmark or an empty bookmark folder. ```APIDOC ## chrome.bookmarks.remove() ### Description Removes a bookmark or an empty bookmark folder. ### Parameters #### id string ### Returns * Promise Chrome 90+ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.