Skip to content

Commit

Permalink
Merge pull request #2 from codex-editor/destruct
Browse files Browse the repository at this point in the history
Destructured params object for constructor
  • Loading branch information
talyguryn committed Aug 3, 2018
2 parents 9377e8a + 78a872e commit 489b874
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ const Delimiter = require('codex.editor.delimiter');

### Load from CDN

Get newest bundle path from [RawGit](https://rawgit.com) — open site and paste link to JS bundle in repository.
You can load specific version of package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/codex.editor.delimiter).

`https://github.com/codex-editor/delimiter/blob/master/dist/bundle.js`
`https://cdn.jsdelivr.net/npm/codex.editor.delimiter@1.0.1`

> Note: use `production` link with commit hash to avoid issues with caching.
Then require this script on page with CodeX Editor.
Require this script on a page with CodeX Editor.

```html
<script src="..."></script>
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle.js

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

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": "codex.editor.delimiter",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [
"codex editor",
"delimiter",
Expand Down
12 changes: 7 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ class Delimiter {

/**
* Render plugin`s main Element and fill it with saved data
* @param {DelimiterData} savedData — previously saved data
* @param {object} config - user config for Tool
* @param {object} api - CodeX Editor API
*
* @param {{data: DelimiterData, config: object, api: object}}
* data — previously saved data
* config - user config for Tool
* api - CodeX Editor API
*/
constructor(savedData, config, api) {
constructor({data, config, api}) {
this.api = api;

this._CSS = {
Expand All @@ -51,7 +53,7 @@ class Delimiter {
this._data = {};
this._element = this.drawView();

this.data = savedData;
this.data = data;
}

/**
Expand Down

0 comments on commit 489b874

Please sign in to comment.