GithubHelp home page GithubHelp logo

linecode / electron-about-window Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rhysd/electron-about-window

0.0 1.0 0.0 478 KB

'About This App' mini-window for Electron apps

Home Page: https://www.npmjs.com/package/about-window

License: MIT License

HTML 10.42% JavaScript 11.68% TypeScript 67.13% CSS 10.78%

electron-about-window's Introduction

'About This App' Window for Electron Apps

npm version

This package provides 'About This App' window for Electron applications.

  • Create 'About This App' window from given parameters
    • Icon path
    • Copy right
    • App name and Versions
    • Description
  • Gather package information from package.json
  • Automatically detect package.json
  • Adjust window size to its contents automatically
  • CSS customizability

You can install this module via npm.

$ npm install about-window

Only one function is exported as default. Please see TypeScript type definition. The function can be called from both main process and renderer process.

export default function openAboutWindow(info: {
    icon_path: string;
    package_json_dir?: string;
    bug_report_url?: string;
    copyright?: string;
    homepage?: string;
    description?: string;
    license?: string;
    css_path?: string;
    adjust_window_size?: boolean;
    win_options?: BrowserWindowOptions;
}): BrowserWindow

Only icon_path property is required, others are optional. I recommend to specify as below to extract information from package.json as much as possible. Path to package.json is also automatically detected if possible.

openAboutWindow({
    icon_path: 'path/to/icon.png'
});

You can check an example app to know how to use this package.

$ git clone https://github.com/rhysd/about-window.git
$ cd about-window/example
$ npm install
$ npm start

# Or for debug
$ npm run debug

Parameter's properties of openAboutWindow()

Name Description Type
icon_path Path to icon file of the application. The path is passed to src property of <img> element. Required string
package_json_dir Path to directory which contains package.json. If not specified, it will try to detect a path to package.json. If also failed, it gives up and show less information in 'About This App' window. Optional string
bug_report_url URL to bug report page. If not specified, 'bugs' entry in package.json is used. Optional string
copyright Copyright notice shown in window. If not specified, it is replaced with license description generated by 'license' entry of package.json. Optional string
homepage URL of application's web page. If not specified, 'homepage' entry of package.json is used instead. Optional string
description Description of the application. If not specified, 'description' entry of package.json is used instead. Optional string
license License of the application. If not specified, 'license' entry of package.json is used instead. This property is used when copyright is not specified. Optional string
win_options Options of 'About This App' window. It is merged into default options. Optional BrowserWindow options object
css_path Path to user-defined CSS file. It will be inserted to DOM of the window. Optional string
adjust_window_size Adjust the window size to its content not to show scroll bar. Optional boolean
open_devtools For debug purpose, Chrome DevTools will start when the window is opened Optional boolean
use_inner_html If true, set the value with .innerHTML on copyright, license and description Default is false Optional boolean

Note: If you set use_inner_html to true, please ensure that contents don't contain any untrusted external input in order to avoid XSS. Be careful.

Screen Shots

Linux

Linux screenshot

OS X

OS X screenshot

Windows

Windows screenshot

License

MIT License.

electron-about-window's People

Contributors

aglezabad avatar rhysd avatar shortsn avatar starpit avatar

Watchers

 avatar

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.