Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

replaying Build Status

Create an object and replay it's methods

Example

Return synchronous interfaces for asynchronously retrieved asynchronous APIs

var Replay = require("../index")

var thing = doThing()

thing.store("boom").collect(function (err, values) {
    console.log("values", values)
})

function doThing() {
    return Replay(["store", "collect"], getRealThing)
}

function getRealThing(cb) {
    setTimeout(function () {
        cb(null, {
            store: store
            , collect: collect
            , values: []
        })
    }, 1000)

    function store(v) {
        this.values.push(v)
    }

    function collect(cb) {
        cb(null, this.values)
    }
}

Installation

npm install replaying

Contributors

  • Raynos

MIT Licenced

About

Create an object and replay it's methods

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages