GithubHelp home page GithubHelp logo

dnalob / node-progressify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jelver/node-progressify

0.0 1.0 0.0 115 KB

Hand-drawn progress bars for your webapps with browserify

JavaScript 100.00%

node-progressify's Introduction

progressify

Hand-drawn progress bars for your webapps with browserify

Computing... 80%

example

server.js

var express = require('express');
var app = express.createServer();
app.use(express.static(__dirname));

var browserify = require('browserify');
app.use(browserify({ entry : 'main.js' }));
app.use(require('progressify'));

app.listen(8080);
console.log('Listening on :8080');

main.js (browser-side)

var progressify = require('progressify');
var $ = require('jquery-browserify');

$(window).ready(function () {
    var p = progressify().appendTo('#p');
    
    setInterval(function () {
        p.percent(p.percent() + 1);
    }, 50);
});

server-side

Just app.use(require('progressify')) to mount the necessary static image handlers using connect for the progress images.

browser-side

var progressify = require('progressify');

var p = progressify(opts={})

Create a new progress object, loading resources from opts.mount.

To mount the resources someplace special you can do

var p = progressify({ mount : '/special' })

in the browser and

app.use('/special', require('progressify'));

Otherwise the resources are just mounted at '/'.

p.appendTo(...)

Calls the internal container div's .appendTo() with the arguments given.

Returns p.

p.percent(n)

Set the percent complete. The floor of n will be clamped to between 0 and 100, inclusive and used to render the percent bar.

Returns p.

p.percent()

Return the percent complete.

p.fraction(n)

Set the completeness as a floating value between 0 and 1, inclusive.

Returns p.

p.fraction()

Return the percent complete as a value between 0 and 1, inclusive.

p.element

Raw jquery handle on the container div

node-progressify's People

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.