Git Product home page Git Product logo

domout's Introduction

domout

Features

Implemented

N/A

Planned

Log "hello world" to a web page shown live in a browser (default to the <body> tag)

var domout = require('domout')
domout.log('hello world')

hello

Log multiple lines in the append mode (default)

var domout = require('domout')
domout.log('first line')
domout.log('second line')
domout.log('third line')

append

Output to different dom components

var domout = require('domout')

domout.load('<table width="100%"><tr><td id="left"></td><td id="right"></td></tr></table>')

var left = domout.$('#left')
var right = domout.$('#right')

left.log('say hi here')
right.log('say hello there')

leftright

Use colors via Chalk

var domout = require('domout'),
	chalk = require('chalk')
	
domout.log(chalk.red('red'))
domout.log(chalk.green('green'))

chalk

Redirect console to domout

var domout = require('domout')
console = domout.pipeFrom(console)

// all existing console.log now go to the browser
console.log('hello world')

Given a set of async tasks running in parallel, log to a different DIV per task

var async = require('async'),
    domout = require('domout')


domout.load('<div id="1"></div><div id="2"></div><div id="3"></div><div id="result"></div>')

// assume each job object has an id=1, 2, 3 respectively
var jobs = [job1, job2, job3]

async.map(jobs,

    function(job, callback) {

        var log = domout.$(job.id).log

        log('start')

        // doing the job
        log('status 25%')

        // doing the job
        log('status 50%')

        // doing the job
        log('status 75%')

        // doing the job
        log('done')

        callback(null, 'done')
    },
    function(err, result) {
        if (err) {
            domout.$('result').error(result)
        } else {
            domout.$('result').log(result)
        }
    }
)

domout's People

Contributors

doubleshow avatar

Watchers

 avatar  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.