dextop
provides a minimal window manager in your browser
Installation | Example | Usage | License
Installation
With npm do
npm install dextop
or use a CDN like
Example
Try Codepen demo online, see example folder on GitHub, or do the following locally
- Clone this repo.
- Install deps:
npm install
. - Start dev server:
npm start
.
Usage
Start with an empty div in your HTML, for example
To import DextopWindow
choose your favourite syntax among:
const DextopWindow = require('dextop').Window
import { DextopWindow } from 'dextop'
Create a DextopWindow instance, add some content.
const myDiv = document const dextopWin = myDiv width: 400 height: 200 dextopWincontentinnerHTML = `My content`
First constructor argument is a DOM element, second argument is an object to provide the following options:
name | default |
---|---|
autohide | true |
width | 400 |
height | 300 |
color | 'rgba(0, 0, 0, 0.1)' |
x | 0 |
y | 0 |
border | 1 |
resizerSize | 35 |
toolbarHeight | 28 |
The content
attribute holds a div which class is dextop-content
, you
can optionally style it with a CSS like the following.
Class DextopWindow
inherits from EventEmitter, it is possible to listen to events like in the following snippet.
dextop
The following events are emitted:
name | data |
---|---|
move | { x, y } |
resize | { width, height } |