Skip to content

Commit

Permalink
Update website documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
betula committed Dec 15, 2019
1 parent 871c897 commit 2446003
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 92 deletions.
22 changes: 6 additions & 16 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,33 +134,23 @@ assign(A, 10);
console.log(resolve(A)); // 10
```

## isolate
## zone

Run your app in isolated Dependency Injection scope. All instances cached for this instance application will be isolated from all cached instances in other scopes. All overrides defined here will be inherited for nested isolated scopes but not available for others. The return value can be object, function, or any other value:
- For object. All methods will be proxied and their return values converted to promises of them
- For function. The function will be proxied and return value converted to promise of it.
- For any value. Return it value without any changes
Run your app in isolated Dependency Injection scope. All instances cached for this instance application will be isolated from all cached instances in other scopes. All overrides defined here will be inherited for nested isolated scopes but not available for others. No return value.

```javascript
const proxy = await isolate(() => {
await zone(async () => {
const app = new App(); // Run you app here
await app.run();
// ...
return {
methodA() {},
methodB() {},
// ...
}
});
// ...
await proxy.methodA();
await proxy.methodB();
```

```javascript
await isolate(async () => {
await zone(async () => {
override(Dep1, Dep2);

await isolate(async () => {
await zone(async () => {
override(Dep2, Dep3);
// ...
console.log(resolve(Dep1) instanceof Dep3); // true
Expand Down
14 changes: 7 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ sidebar_label: Getting Started

Async context based Dependency Injection for Node.JS without pain with Dependency Injection Container, dependency registration, and configuration.

- You can use it at any place of your application without rewrite your applications architecture or other preparations or initializations.
- Each dependency can be class, function, or any another value, and plain JavaScript object too.
- You can override your dependencies for organizing modules architecture, or unit testing without hack standard Node.JS require mechanism.
- You can use TypeScript or JavaScript, with decorators or not. Different syntaxes for one mechanism. You can use the constructor to provide dependencies or not, as you wish.
- You can create isolate context for multiple instances of your application (Dependency Injection scopes) with a different set of dependencies, overrides, and instances.

<!--DOCUSAURUS_CODE_TABS-->

<!--TypeScript with decorators-->
Expand Down Expand Up @@ -155,4 +149,10 @@ new App().start(); // You can create an instance directly as usually class
<!--END_DOCUSAURUS_CODE_TABS-->


If you have questions or something else for me or this project, maybe architectures questions, improvement ideas or anything else, please make the issue.
- You can use it at any place of your application without rewrite your applications architecture or other preparations or initializations.
- Each dependency can be class, function, or any another value, and plain JavaScript object too.
- You can override your dependencies for organizing modules architecture, or unit testing without hack standard Node.JS require mechanism.
- You can use TypeScript or JavaScript, with decorators or not. Different syntaxes for one mechanism. You can use the constructor to provide dependencies or not, as you wish.
- You can create isolate context for multiple instances of your application (Dependency Injection scopes) with a different set of dependencies, overrides, and instances.

If you have questions or something else for me or this project, maybe architectures questions or improvement ideas, please make the issue in github.
68 changes: 0 additions & 68 deletions website/pages/en/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"examples",
"overrides",
"unit-testing",
"isolate",
"zone",
"api"
]
}
Expand Down
18 changes: 18 additions & 0 deletions website/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="refresh"
content="0; url=docs/"
/>
<script type="text/javascript">
window.location.href = 'docs/';
</script>
<title>node-provide</title>
</head>
<body>
If you are not redirected automatically, follow this
<a href="docs/">link</a>.
</body>
</html>

0 comments on commit 2446003

Please sign in to comment.