Skip to content

Latest commit

 

History

History
55 lines (43 loc) · 1.47 KB

README.md

File metadata and controls

55 lines (43 loc) · 1.47 KB

Radis logo

Travis Coverage Status Greenkeeper badge

NPM

Quickstart

const { radis } = require('radis');


class Unicorn {
  constructor(name) {
      this.name = name;
  }
  
  poop() {
    console.log(`${this.name} poop rainbow`);
  }
}

class UnicornProvider {
    constructor($injector, name) {
        this.name = name;
    }
    setName(name) {
        this.name = name;
    }
    $get() {
        return new Unicorn(this.name);
    }
}

radis
    .module('app', [])
    .provider('alice', UnicornProvider)
    .provider('anonymousUnicorn', UnicornProvider)
    .config((anonymousUnicornProvider) => anonymousUnicornProvider.setName("paul"))
    .run((alice, anonymousUnicorn) => {
        alice.poop(); // alice poop rainbow
        anonymousUnicorn.poop(); // paul poop rainbow
    })
    .bootstrap()
;

Requirement

Radis use ES6 syntax internally so it require node >= 6.

Documentation

Go to documentation