Skip to content

Commit 3be5e27

Browse files
author
craig
committed
2.0.0 / 2022-03-23
================== * Initial esm support - @craigparra
1 parent 59b71ff commit 3be5e27

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,29 @@ wiring (injection) of property references and config placeholders.
1616

1717
<a name="usage">Usage</a>
1818
--------------------------------
19+
### Browser
20+
21+
The module is also able to be used directly in the browser, in combination with the logger and config modules.
22+
You can either import the ApplicationContext globally as an IIFE (Immediately Invoked Function Expression),
23+
as follows:
24+
25+
```html
26+
<script src="https://cdn.jsdelivr.net/npm/@alt-javascript/cdi/dist/alt-javascript-applicationcontext-iife.js"></script>
27+
<script>
28+
import { SimpleClass } from'./index.js';
29+
30+
const applicationContext = new ApplicationContext(SimpleClass);
31+
</script>
32+
```
33+
34+
Or import the ES6 module bundle from a module, as follows:
35+
36+
```javascript
37+
import { ApplicationContext } from 'https://cdn.jsdelivr.net/npm/@alt-javascript/cdi/dist/alt-javascript-cdi-esm.js'
38+
import { SimpleClass } from'./index.js';
39+
40+
const applicationContext = new ApplicationContext(SimpleClass);
41+
```
1942

2043
### Singleton Components
2144

0 commit comments

Comments
 (0)