1.3.2 • Published 5 years ago

app-buttons v1.3.2

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

#app-buttons

A library for quickly creating windows-alike applications buttons. The library can either automatically take on a dimension to fit into the program, or you can use the standard sizes which are in windows.

##How to get going quickly

First of all, require the library

var appB = require("app-buttons");

To append the app buttons to an element, simply use the following line of code:

appB.appButtons(parent, adaptive);

Here's what the two values mean:

  • parent: The parent element to append the application buttons to
  • adaptive: a boolean that says wether or not the library should try to adapt to the parent container or not.

You can also specify a variable when calling the library, for instance:

var appButtons = appB.appButtons(document.getElementById("app-bar"), true);

This will return you the parent container for all the application buttons.

##How to handle click events You probably want to be able to handle all click events yourself, and therefore a set of functions are called based upon what buttons are pressed. Here are the possible scenarios:

Minimize button is pressed

The function programMinimize() is called.

Maximize button is pressed

The function programMaximize() is called.

Close button is pressed

The function programExit() is called.

Here's a working example:

    const appB = require("app-buttons");

    //Append buttons to the application bar
    appB.appButtons(document.getElementById("app-bar"), true);

    function programExit() {
        const remote = require('electron').remote
        let w = remote.getCurrentWindow()
        w.close()
    }

    function programMaximize() {
        //Do something
    }

    function programMinimize() {
        //Do something
    }

Remember: It is important to define these functions. The library won't close the program unless you write some code that tells it to do so. This is to add flexibility.

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago