New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

get-chrome-tabs

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-chrome-tabs

Get information of the currently opened Chrome tabs, for example URLs and titles

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

get-chrome-tabs

npm version Build Status Coverage Status

Get information of the currently opened Chrome tabs, for example URLs and titles

 

const getChromeTabs = require('get-chrome-tabs');

(async () => getChromeTabs() /* => [
  {
    windowIndex: 0,
    windowVisible: true,
    url: 'https://github.com/',
    title: 'GitHub',
    active: true,
    loading: false
  },
  {
    windowIndex: 0,
    windowVisible: true,
    url: 'https://www.npmjs.com/package/get-chrome-tabs',
    title: 'get-chrome-tabs - npm',
    active: false,
    loading: false
  },
  {
    windowIndex: 1,
    windowVisible: true,
    url: 'https://example.org/',
    title: 'Example Domain',
    active: true,
    loading: false
  }
] */)();

Installation

Use npm.

npm install get-chrome-tabs

API

const getChromeTabs = require('get-chrome-tabs');

getChromeTabs([option])

option: Object
Return: Promise<Array<Object>>

macOS with JXA support is required.

Each object included in the resultant array has the following properties:

  • windowIndex integer – An index of the window which contains the tab (0 (foremost), 1, ...)
  • windowVisible boolean – Whether the window which contains the tab is visible or not
  • url string – A URL currently opened by the tab
  • title string – The tab title
  • active boolean – Whether the tab is currently selected or not. Each window has one active tab.
  • loading boolean - Whether the tab is loading or not

It will be rejected when Chrome is not running.

option.app

Type: string (either 'canary' or 'chromium')

Instead of Chrome (default), refer to Chrome Canary or Chromium.

// When Chrome is not running but Chrome Canary is running

(async () => {
  try {
    await getChromeTabs();
  } catch (err) {
    err.message; //=> 'Tried to get tabs of Chrome, but Chrome is currently not running.'
  }

  await getChromeTabs({app: 'canary'}); //=> [{windowIndex: 0, windowVisible: true, ...}, ...]
})();

License

ISC License © 2018 Shinnosuke Watanabe

Keywords

chrome

FAQs

Package last updated on 09 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts