Skip to content

jerome-quere/radis

Repository files navigation

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