Skip to content

dgaubert/venom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Venom

Simple way to add DI to your javascript projects.

Installation

Node.js, on project path:

npm install venom

Browser:

Examples

Node projects:

var venom = require('venom');

// Dependency to inject
var ElectricEngine = {
  start: function () {
    return 'Fisiuu!!';
  }
};

// Constructor
function Car (ElectricEngine) {
  this.engine = ElectricEngine;
}

Car.prototype.start = function () {
  return this.engine.start();
};

venom.add('ElectricEngine', ElectricEngine);
var car = venom.create(Car);

console.log(car.start()); // Fisiuu!!

Browser:

<script type="text/javascript" src="venom.min.js"></script>
<script type="text/javascript">
  // Dependency to inject
  var ElectricEngine = {
    start: function () {
  	  return 'Fisiuu!!';
    }
  };

  // Constructor
  function Car (ElectricEngine) {
    this.engine = ElectricEngine;
  }

  Car.prototype.start = function () {
    return this.engine.start();
  };

  venom.add('ElectricEngine', ElectricEngine);
  var car = venom.create(Car);

  alert(car.start()); // Fisiuu!!
</script>

To view a full guide, take a look: guide.md

Contributions

Do you want to contribute?. Please, follow the below suggestions:

  • To add features, pull requests to develop branch.
  • To fix bugs in release version, pull request both master and develop branches.
  • Be consistent with style and design decisions.
  • Cover your implementation with tests, add it under test/*-test.js.

Change history

To view change history, please visit: history.md

Versioning strategy:

  • The major version will increase for any backward-incompatible changes.
  • The minor version will increase for added features.
  • The patch version will increase for bug-fixes.

License

To view the MIT license, please visit: The MIT License (MIT)

About

Simple way to add DI to your javascript projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published