Skip to content

Commit a992844

Browse files
committed
Add the calls hook to the README.md.
1 parent 434a346 commit a992844

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ Skippy is designed to be an easy to use, robust, and well tested dependencies co
1010
- Instantiate service as described in the dependencies configuration.
1111
- Configure what should be used as service constructor parameters: you can pass another services as reference, parameters, or any values you have configured.
1212
- Manage singleton instance of service (not defined by design pattern, but by configuration).
13-
- Check the dependencies graph to avoid cyclic dependencies (only on development environment: `NODE_ENV="development"`).
13+
- Call custom method on service instance to finish it configuration.
14+
- Check the dependencies graph to avoid cyclic dependencies.
1415
- Allowing injection of service mock (only in test environment: `NODE_ENV="test"`).
1516

1617
#### What Skippy don't do (and never will)
1718
- Introspect JSDoc or parameters name to determine witch service should be inject in a constructor function. You have to define service dependencies in a configuration file.
1819
- Coffee
1920

2021
#### What Skippy don't at the moment (maybe one day)
21-
- Use factory service to generate another service
22-
- Generate a lazy loading proxy function
2322
- Manage service scope (allowing private service, who can only be used to instantiate other service, not exposed to the world)
23+
- Use factory service to generate another service (delayed, the post service creation hooks do a part of the job for now)
24+
- Generate a lazy loading proxy function (delayed, until ES6 proxy is well supported)
2425

2526

2627
## Installation
@@ -100,6 +101,15 @@ module.exports = [
100101
"@foo.serviceA",
101102
"@foo.serviceB"
102103
]
104+
},
105+
{
106+
"name": "foo.serviceD",
107+
"service": require("./ServiceD"),
108+
"calls": {
109+
"setLocale": [
110+
"@foo.serviceB",
111+
"%default.locale%"
112+
]
103113
}
104114
];
105115
```
@@ -109,6 +119,7 @@ A service configuration have four possible keys:
109119
- `service` (`function`, mandatory): the service constructor function reference.
110120
- `singleton` (`boolean`, optional, default `true`): If `true`, the service will be a singleton. If `false`, a new service will be instantiated each time.
111121
- `arguments` (`array`, optional, default empty array): An array of the value to inject in the service constructor (see "Arguments" section for more informations).
122+
- `calls` (`object`, optional, default empty array): A map of the method to call on the service, each method should have it `arguments` array (see "Arguments" section for more informations).
112123

113124

114125
### Arguments

0 commit comments

Comments
 (0)