Giter Site home page Giter Site logo

Comments (5)

michaellzc avatar michaellzc commented on September 22, 2024

Hi,

I’m not sure I understand your question (feel free to rephrase the question in Chinese).

I suppose you’re looking for the documentation of the ‘opts’ object. It is intended to pass down to the “open” library (formerly known as “opn”) when launching with AppleScript doesn’t work out.

https://github.com/ExiaSR/better-opn/blob/master/src/index.js#L67

Please refer to their docs https://www.npmjs.com/package/open

from better-opn.

CGerAJ avatar CGerAJ commented on September 22, 2024

使用场景
当我使用nodemon的时候 每次会自动刷新当前tab 我不希望刷新 不知道有没有配置项可以禁用自动刷新?

from better-opn.

CGerAJ avatar CGerAJ commented on September 22, 2024

https://github.com/ExiaSR/better-opn/blob/c5d60ea88ba1f000f3bbc8fbbc0e97be239bb47b/src/index.js#L43

我想我也许想修改的是这个object

from better-opn.

michaellzc avatar michaellzc commented on September 22, 2024

https://github.com/ExiaSR/better-opn/blob/c5d60ea88ba1f000f3bbc8fbbc0e97be239bb47b/src/index.js#L43

我想我也许想修改的是这个object

@CGerAJ

Because tab reloading is controlled by AppleScript, there is no easy way to do customization from JS unless we include an additional AppleScript to achieve such behaviour in the release.

I believe the ideal solution for your use case is to make path to the AppleScript configurable, then you may customize the behaviour as you wish.

Implementation

const startBrowserProcess = (browser, url, opts = { pathToAppleScript: '../openChrome.applescript' }) {

    // ...

    execSync(`osascript ${opts.pathToAppleScript} "${encodeURI(url)}"`)

    // remove `pathToAppleScript` from `opts` before fallback to `open`
}

Usage

const opn = require('better-opn')

open('https://localhost:3000', { pathToAppleScript: 'full_path_to_custom_applescript' })

Feel free to open a PR if this meets your needs. I am really stressed with school work, properly won't have much availability to work on this.

from better-opn.

CGerAJ avatar CGerAJ commented on September 22, 2024

非常感谢您的建议 我需要查阅一下文档,再考虑如何开始~ 有时间我研究一下 谢谢~

from better-opn.

Related Issues (13)

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.