@bunchtogether/desktop-window-button

1.0.9 • Public • Published

Desktop Window Button

npm version

Minimal, cross-browser library which creates a window on the desktop containing an image that closes when clicked or the return callback is executed.

Implemented using node-sdl2.

Install

yarn add @bunchtogether/desktop-window-button

Users may need to install SDL 2.0.

Usage

const path = require('path');
const openDesktopWindowButton = require('desktop-window-button');

const run = async () => {
  const src = path.resolve(__dirname, 'fruits.png');
  const callback = () => {
    console.log("Button closed after click or close function");
  }
  const x = 100;
  const y = 100;
  const closeDesktopWindowButton = openDesktopWindowButton(src, x, y, callback);
  await new Promise((resolve) => setTimeout(resolve, 3000));
  closeDesktopWindowButton();
}

run();

API

Table of Contents

openDesktopWindowButton

Create a window on the desktop containing an image that closes when clicked or the return callback is executed.

Parameters

  • src string Path to image file
  • x number X coordinate at which to place the image button
  • y number Y coordinate at which to place the image button
  • callback Function Callback called when the image button is clicked or closed by the returned function

Returns Function Close the desktop window button

Readme

Keywords

none

Package Sidebar

Install

npm i @bunchtogether/desktop-window-button

Weekly Downloads

1

Version

1.0.9

License

MIT

Unpacked Size

3.79 MB

Total Files

40

Last publish

Collaborators

  • bunchtogether