Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

browser-sync-reuse-tab

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-sync-reuse-tab - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

4

CHANGELOG.md
# Changelog
## 2.0.0
Update reference to BrowserSync utils module
## 1.0.0
First release

17

index.js

@@ -0,4 +1,4 @@

var browserSyncUtils = require('browser-sync/dist/utils')
var exec = require('child_process').exec
var path = require('path')
var browserSyncUtils = require('browser-sync/lib/utils')

@@ -15,9 +15,12 @@ /**

* @param {BrowserSync} browserSync
* @param {string} urlToOpen
* @param {String} urlToOpen
*/
function reuseExistingTab (browserSync, urlToOpen) {
var browserSyncInstance = browserSync.instance
if (urlToOpen === false) return
urlToOpen = urlToOpen || 'local'
var browserSyncInstance = browserSync.instance
return function () {

@@ -32,8 +35,8 @@ var url = browserSyncInstance.options

if (error) {
var message = '{red:browser-sync-reuse-tab failed to re-use the exisiting tab :( The error was:\n\n'
// log message to console
var message = '{red:browser-sync-reuse-tab failed to reuse the existing tab :( The error was:\n\n' + error.message + '}'
message += error.message
browserSyncInstance.logger.info(message)
browserSyncInstance.logger.info(message + '}')
// fallback to default BrowserSync behaviour
browserSyncInstance.options = browserSyncInstance.options.set('open', true)

@@ -40,0 +43,0 @@ browserSyncUtils.openBrowser(url, browserSyncInstance.options)

{
"name": "browser-sync-reuse-tab",
"version": "1.0.0",
"version": "1.0.1",
"description": "Attempt to reuse an existing tab that was opened by BrowserSync",

@@ -35,6 +35,4 @@ "main": "index.js",

"browser-sync": "^2.16.0",
"standard": "^8.1.0"
},
"dependencies": {
"standard": "^10.0.0"
}
}

@@ -8,10 +8,8 @@ # browser-sync-reuse-tab

Attempt to reuse an existing tab that was opened by BrowserSync.
Attempt to reuse an existing tab that was opened by [BrowserSync](https://www.browsersync.io/).
When you start BrowserSync, a tab is opened in your browser pointing to BrowserSync's dev server. When you restart BrowserSync another tab is opened in the browser. The more times you restart BrowserSync, the more tabs will be opened in the browser.
Depending on your configuration, when you start BrowserSync, a tab is opened in your browser pointing to BrowserSync. When you restart BrowserSync another tab is opened in the browser. The more times you restart BrowserSync, the more tabs that will be opened in the browser.
This package fixes this problem by trying to reuse an existing tab that was already opened by BrowserSync. When you restart BrowserSync, the previously opened tab will be focused and reloaded. The window that the tab is in will also be focused.
This package gets around this by trying to reuse an existing tab that was already opened by BrowserSync. When you restart BrowserSync, the previously opened tab will be focused and reloaded. The window that the tab is in will also be focused.
Hardly a first world problem, but it annoyed me enough to go ahead and hack my way around it :)
**At this moment, only Google Chrome on OS X >= 10.10 is supported, see notes below.**

@@ -46,3 +44,3 @@

browserSync.init({
server: "./app",
server: './src',
open: false // do not automatically open browser

@@ -58,11 +56,11 @@ }, browserSyncReuseTab)

Only Google Chrome at the moment. Pull requests are welcome :)
Only Google Chrome at the moment.
### Which operating systems are supported?
Only OS X >= 10.10
Only OS X >= 10.10 at the moment.
### Why is only OS X >= 10.10 supported?
This package use's [JavaScript](https://developer.apple.com/library/content/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/Introduction.html#//apple_ref/doc/uid/TP40014508) to control the browsers behaviour. Support for using JavaScript for Automation was added in OS X 10.10. Older versions of OS X could be supported if i had used AppleScript instead. But AppleScript is gross.
This package use's [JavaScript](https://developer.apple.com/library/content/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/Introduction.html#//apple_ref/doc/uid/TP40014508) to control the browsers behaviour. Support for using *JavaScript for Automation* was added in OS X 10.10. Older versions of OS X could be supported if i had used AppleScript instead. But AppleScript is gross.

@@ -69,0 +67,0 @@ ### This package seems to only really be useful to developers on OS X using Google Chrome. What gives?

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc