GithubHelp home page GithubHelp logo

wreqr.injector's Introduction

Wreqr.Injector

A really simple dependency injection based on Backbone.Wreqr.RequestResponse

This library add 3 methods to Backbone.Wreqr.RequestResponse, which ease dependency injection across multiple modules.

Usage

This module is available as an IIFE or as an UMD module, which means that it should works on commonjs, AMD, or in browser loaded in a script tag.

It's only dependency is Backbone.Wreqr.RequestResponse which means that you must have also Backbone.

Docs

See the docs folder for more information and some examples.

API

set(name, value)

Register a value with the key name in the dependency injector.

Returns a reference to itself enable chaining calls.

get(name)

Retrieve a value with the key name in the dependency injector.

Returns the asked value or if not found will throw an error.

req(name, args)

Get a reference to a name handler with optional args that will can be called on runtime.

Returns a function.

Before executing the handler it should be defined first or it will throw an error. The main idea behind req is to setup handler that will be defined at runtime.

The motivation behind this function is multiple:

  • to permit the removal of hard coded expression
  • to ease testing
  • to adapt parameterize behaviour
  • ...

wreqr.injector's People

Contributors

stephanebachelier avatar

Watchers

 avatar  avatar

Forkers

deboned

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.