Code Monkey home page Code Monkey logo

ventus's Introduction

Ventus WM Build Status Join the chat at https://gitter.im/rlamana/Ventus

A window manager written in Javascript, HTML5 and CSS3.

Live Demo! (http://www.rlamana.com/ventus) | Video Demo

This project started as an experiment and even though it was stable enough it was never meant to be mantained over time. However, feel free to fork and send PRs!

Version 0.3.0 migrates code to webpack and ES6 and is available in branch: https://github.com/rlamana/Ventus/tree/v0.3.0.

Creating a new window manager

var wm = new Ventus.WindowManager();

Creating a new empty window

var window = wm.createWindow({
	title: 'A new window',
	x: 50,
	y: 50,
	width: 400,
	height: 250
});

window.open();

Creating a new empty window without animations and staying inside of the space

var window = wm.createWindow({
	title: 'A new window',
	x: 50,
	y: 50,
	width: 400,
	height: 250

	animations: false,
	stayinspace: true,
});

window.open();

Creating a new window wrapping a DOM Element

Using a query
wm.createWindow.fromQuery('#element .selector', {
	title: 'My App',
	width: 330,
	height: 400,
	x: 670,
	y: 60
});
Using a reference
wm.createWindow.fromElement(domElement, {
	title: 'My App',
	width: 500,
	height: 500,
	x: 0,
	y: 0
});

Listening to events

Defining handlers in constructor
var window = wm.createWindow({
	title: 'A new window',
	events: {
		open: function() {
			console.log('The window was open');
		},
		
		closed: function() {
			console.log('The window was closed');
		},
	}
});
Using the 'signals' property
var window = wm.createWindow({
	title: 'A new window'
});

window.signals.on('open', function() {
	console.log('The window was open');
});

Destroying a window

When a window is closed the content is not destroyed by default. This way windows can be open again keeping the wrapped DOM element. To completely destroy the window, the method 'destroy' needs to be called:

var window = wm.createWindow({
	title: 'A new window',
	events: {
		closed: function() {
			this.destroy();
		}
	}
});

ventus's People

Contributors

rlamana avatar brammittendorff-dd avatar joshuacwebdeveloper avatar andreybutenko avatar dependabot[bot] avatar gingerbear avatar dakshshah96 avatar dravenshorst avatar dustinbrett avatar crazyjul avatar maciek-codes avatar gitter-badger avatar amatiasq avatar m-elbably avatar

Watchers

James Cloos 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.