Skip to content
This repository
Browse code

docs

  • Loading branch information...
commit f5bd00c72869b27fe9aa332475e410afc20017c2 1 parent e3320c2
Sean Hess authored July 12, 2012

Showing 1 changed file with 13 additions and 1 deletion. Show diff stats Hide diff stats

  1. 14  README.md
14  README.md
Source Rendered
@@ -57,6 +57,7 @@ greetings.coffee
57 57
       ...
58 58
 
59 59
 app.coffee
  60
+
60 61
     # you have to do this in every file you want to use robot
61 62
     Greetings = require "greetings"
62 63
     greetings = Greetings("en")
@@ -70,7 +71,7 @@ app.coffee
70 71
 
71 72
 *This gets much worse* when your dependencies have dependencies of their own. You have to remember in which order to configure them so you can pass them into each other. 
72 73
 
73  
-### Dependenable
  74
+### Using Dependenable
74 75
 
75 76
 Dependable automates this process. In the following example, you don't need to register the modules in order, or do it more than once (it will work for dependencies of dependencies)
76 77
 
@@ -99,7 +100,18 @@ app.coffee
99 100
     itsAliiiive = -> 
100 101
       console.log robot.hello()
101 102
 
  103
+### Using Dependable's Load
  104
+
  105
+You can load files or directories instead of registering by hand. See below. 
  106
+
102 107
 ## Reference
103 108
 
  109
+`container.register(name, function)` - registers a dependency by name. `function` can be a function that takes dependencies and returns anything, or an object itself with no dependencies.
  110
+
  111
+`container.load(fileOrFolder)` - registers a file, using its file name as the name, or all files in a folder. Does not follow sub directories
  112
+
  113
+`container.get(name)` - returns a module by name, with all dependencies injected
  114
+
  115
+`container.resolve(cb)` - calls cb like a dependency function, injecting any dependencies found in the signature
104 116
 
105 117
 

0 notes on commit f5bd00c

Please sign in to comment.
Something went wrong with that request. Please try again.