Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A dependency inversion utility for JavaScript
PogoScript JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src invertism 0.0.1
test invertism 0.0.1
.gitignore invertism 0.0.1
README.md less rubbish readme
package.json invertism 0.0.1

README.md

Invertism

A dependency inversion utility for JavaScript.

Use invertism to inject arguments into constructors and other functions, from a set of named services.

Install

npm install invertism

Usage

invertism = require 'invertism'

services = {
    time () = '12:34'
    display (text) = "[#(text)]"
}

Clock (time, display) =
    this.time = time
    this.display = display

Clock.prototype.read () =
    this.display(this.time())

Bound Clock = invertism.bind(Clock, services)

clock = @new Bound Clock () // no arguments!
clock.read()                // '[12:34]'
Something went wrong with that request. Please try again.