Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created October 2, 2012 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/3816867 to your computer and use it in GitHub Desktop.
Save Raynos/3816867 to your computer and use it in GitHub Desktop.

ready

A ready listener, the easy way.

Example

The ready function fires your callback if it's ready or wait until it's called with no arguments to signal it is ready.

var Ready = require("ready")
    , r1 = Ready()
    , r2 = Ready()

r1(function onReady() {
    console.log("r1 ready")
})

setTimeout(r1, 1000)

r2()

r2(function onReady() {
    console.log("r2 is already ready")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment