Coder Social home page Coder Social logo

basic-controllers's Introduction

WAVESJS - BasicControllers

A set of basic controllers for rapid prototyping

Documentation

Themes

Two themes are available: 'light' (default) and 'dark'. The theme can be switched via the setTheme method of the namespace

var wavesBasicControllers = require('waves-basic-controllers');
wavesBasicControllers.setTheme('dark');

Title

const { Title } = require('waves-basic-controllers');
const $container  = document.querySelector('#container');

const title = new Title(legend);
$container.appendChild(title.render());

// ... or simply

new Title(legend, $container);

Buttons

const { Buttons } = require('waves-basic-controllers');
const $container  = document.querySelector('#container');

const buttons = new Buttons(legend, [...ids]);
$container.appendChild(buttons.render());

buttons.on('change', (id) => {
  switch (id) {
    // ...do stuff
  }
});

// ... or simply

new Buttons(legend, [...ids], $container, (id) => {
  switch (id) {
    // ...do stuff
  }
})

Toggle

const { Toggle } = require('waves-basic-controllers');
const $container  = document.querySelector('#container');

const toggle = new Toggle(legend, defaultState);
$container.appendChild(toggle.render());

toggle.on('change', function(active) {
  // ...do stuff
});

// ... or simply

new Toggle(legend, defaultValue, $container, () => {
  // ...do stuff
});

Slider

const { Slider } = require('waves-basic-controllers');
const $container = document.querySelector('#container');

const slider = new Slider(legend, min, max, step, defaultValue, unit, size);
$container.appendChild(slider.render());

slider.on('change', (value) => {
  // ...do stuff
});

// ... or simply

new Slider(legend, min, max, step, defaultValue, unit, size, $container, () => {
  //do stuff
});

size can be 'large', 'medium' or 'small' ('medium' is the default value)

Conventions

  • $container can be a DOMElement or a css selector

Contributing

This module relies on babel and browserify, these modules should be installed globally.

sudo npm install -g babel
sudo npm install -g browserify

and linked into your development folder

npm link babel
npm link browserify

basic-controllers's People

Contributors

b-ma 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.