Code Monkey home page Code Monkey logo

detect-browsers's People

Contributors

petersonwpm avatar sbspk avatar subash avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

detect-browsers's Issues

Allow getAvailableBrowsers to pass options to which module

Hi, thanks for this library!

I'm playing with it inside an Electron app and I've encountered a minor issue (with Electron). Short story: the Electron renderer process.env doesn't inherit the variables from the main process on Linux, which are available through renderer.process.env. So I have to use the which options to pass the PATH env variable.

I would basically like to do something like:

let opt = { path: remote.process.env.PATH };
detectBrowsers.getAvailableBrowsers(opt);

Which can be achieved just adding the optional parameter to getAvailableBrowsers:

async function getExecutable(browser, opt) {
  const execs = browsers[browser];
  if(!execs || !execs[process.platform]) return;
  for(const exec of execs[process.platform]) {
    const executable = await which(exec, opt).catch(()=>{});
    if(executable) return executable;
  }
}

async function getAvailableBrowsers(opt) {
  const list = [];
  for(const browser of Object.keys(browsers)) {
    const exec = await getExecutable(browser, opt);
    if(exec) list.push({ browser, path: exec });
  }
  return list;
}

I guess passing options to the which module could be useful in some other cases, so it would be nice if a future release included the ability to do it somehow.

Publish to NPM as CommonJS modules

I cannot use your NPM package because it uses ES2015/ES6 modules. Please use something like Babel or Buble to transpile your modules to commonjs modules before publishing on NPM!

Right now, I can only use version 2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.