Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Edited README.md via GitHub

  • Loading branch information...
commit c2a5cc0d2af384abee033b7da66b99bc9e9d1ff3 1 parent 59ea8f5
@neonstalwart neonstalwart authored
Showing with 40 additions and 2 deletions.
  1. +40 −2 README.md
View
42 README.md
@@ -1,10 +1,48 @@
#twine
##overview
-twine is an [asynchronous](http://wiki.commonjs.org/wiki/Promises) [inversion of control](http://martinfowler.com/articles/injection.html) container for javascript. twine achieves dependency injection via [object composition](https://github.com/kriszyp/compose) - ie mixins applied before construction.
+twine is an [asynchronous](http://wiki.commonjs.org/wiki/Promises) [dependency inversion](http://martinfowler.com/articles/injection.html) container. twine injects dependencies into components via [object composition](https://github.com/kriszyp/compose) - ie mixins applied before construction.
+
+dependency inversion coupled with twine's `fibers` extension API makes twine a very powerful tool. twine's power is exposed through a very simple configuration API that also makes twine easy to use.
+
+```js
+define(function (require) {
+ // create a container
+ var Twine = require('twine');
+ var container = new Twine();
+
+ // configure the container
+ container.configure({
+ components: [
+ {
+ id: 'app',
+ module: 'my/app',
+ deps: {
+ session: 'session'
+ }
+ },
+ {
+ id: 'session',
+ module: 'my/app/session'
+ }
+ ]
+ }).then(function (container) {
+ // resolve your app
+ container.resolve('app').then(function (app) {
+ // start your app
+ app.startup();
+
+ // NOTE: app.session will be the session component
+
+ // ... at some time later don't forget to cleanup
+ container.destroy();
+ });
+ });
+});
+```
##influences
-although i've never actually used any of these libraries, the design of twine was influenced by [Castle Windsor](http://docs.castleproject.org/Windsor.MainPage.ashx), [Cairngorm 3](http://sourceforge.net/adobe/cairngorm/wiki/CairngormLibraries/) and [Parsley](http://www.spicefactory.org/parsley/). those frameworks should be commended for their clear and comprehensive documentation.
+the design of twine was influenced by [Castle Windsor](http://docs.castleproject.org/Windsor.MainPage.ashx), [Cairngorm 3](http://sourceforge.net/adobe/cairngorm/wiki/CairngormLibraries/) and [Parsley](http://www.spicefactory.org/parsley/). those frameworks should be commended for their clear and comprehensive documentation.
##documentation
twine has a [wiki](https://github.com/cello/twine/wiki).
Please sign in to comment.
Something went wrong with that request. Please try again.