Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into type-script
Browse files Browse the repository at this point in the history
# Conflicts:
#	demo/dist/dc.min.js
#	demo/dist/dc.min.js.map
#	src/dc-factory.js
  • Loading branch information
Ofigelov committed Oct 25, 2020
2 parents c3d60cd + 9a3ce74 commit 1be0379
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dcFactory.register(CollapsedComponent);


// later after registering all your components, when your page is ready
dcFactory.init();
dcFactory.init(document.body);

```

Expand All @@ -72,13 +72,13 @@ Type: `string | CallableFunction: HTMLElement[]`

CSS selector which will override searching by getNamespace() and be used for searching elements of given componentClass.

### dcFactory.init(root = document.body, withLazy = true)
### dcFactory.init(root, withLazy = true)

Starts the factory on a given root: finds and creates all registered components within the root

#### root

*Optional*<br>
*Required*<br>
Type: `HTMLElement`

#### withLazy
Expand All @@ -100,4 +100,4 @@ Type: `HTMLElement`


## License
[MIT](https://choosealicense.com/licenses/mit/)
[MIT](https://choosealicense.com/licenses/mit/)
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ <h2>Simple example</h2>

<p>
Call dcFactory.register with your components, and then starts the factory by calling
dcFactory.init()
dcFactory.init(document.body)
</p>

<script data-live-highlight>
dcFactory.register(CollapsedComponent);
dcFactory.init();
dcFactory.init(document.body);
</script>
</div>

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deleteagency/dc",
"version": "2.0.2",
"version": "3.0.0-0",
"description": "",
"main": "src/index.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/dc-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class DcFactory {
* @param {HTMLElement} root
* @param {boolean} withLazy - Whether or not initialize component which marked as lazy
*/
public init: (root?: HTMLElement, withLazy?: boolean) => void = (root = document.body, withLazy = true) => {
public init: (root?: HTMLElement, withLazy?: boolean) => void = (root = document.documentElement, withLazy = true) => {
this._registeredComponents.forEach((rComponent) => {
this._initComponent(root, rComponent, withLazy);
});
Expand Down

0 comments on commit 1be0379

Please sign in to comment.