browser-tabs-manager-lib
v1.0.4
Published
A library to manage browser tabs with complex logic, contained in a single file.
Downloads
1
Maintainers
Readme
browser-tabs-manager-lib
A library to manage browser tabs with complex logic but contained in a single file. It allows creating, listing, and closing tabs with unique identifiers.
Installation
Install browser-tabs-manager-lib
using npm:
npm install browser-tabs-manager-lib
Usage
Import TabsManager
and use it to manage your tabs:
const TabsManager = require('browser-tabs-manager-lib');
const tabManager = new TabsManager();
// Create a new tab
const tabId = tabManager.createTab('https://www.example.com');
// List all tabs
console.log(tabManager.listTabs());
// Close a tab
tabManager.closeTab(tabId);
Events
TabsManager
emits events when tabs are created or closed:
tab-created
: Fired when a new tab is created. Returns tab info.tab-closed
: Fired when a tab is closed. Returns the tab's ID.