Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed May 9, 2018
1 parent 54816e3 commit ac069b3
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This repository is the JavaScript query editor widget built with Svelte. For mor

## Setting up Nymph Query Editor

<div dir="rtl">Quick Setup with NPM</div>
(with UMD in Vanilla ES 5)

```sh
npm install --save nymph-query-editor
Expand All @@ -30,20 +30,18 @@ To use, include Locutus' strtotime and the files from the lib folder, and instan
if (typeof module !== "undefined") _module = module;
module = {};
</script>
<script src="/node_modules/locutus/php/datetime/strtotime.js"></script>
<script src="node_modules/locutus/php/datetime/strtotime.js"></script>
<script type="text/javascript">
strtotime = module.exports;
delete module;
if (typeof _module !== "undefined") module = _module;
</script>
<!-- Query Editor JS -->
<script src="/node_modules/nymph-query-editor/lib/ValueEditor.js"></script>
<script src="/node_modules/nymph-query-editor/lib/SelectorEditor.js"></script>
<script src="/node_modules/nymph-query-editor/lib/QueryEditor.js"></script>
<script src="node_modules/nymph-query-editor/lib/ValueEditor.js"></script>
<script src="node_modules/nymph-query-editor/lib/SelectorEditor.js"></script>
<script src="node_modules/nymph-query-editor/lib/QueryEditor.js"></script>
<script type="text/javascript">
((global, QueryEditor) => {
// If you don't use AMD or CJS, just do this:
QueryEditor = (QueryEditor && QueryEditor.__esModule) ? QueryEditor["default"] : QueryEditor;
const myQueryEditor = new QueryEditor({
target: document.querySelector('query-editor'),
data: {
Expand All @@ -62,14 +60,15 @@ To use, include Locutus' strtotime and the files from the lib folder, and instan
]
}
});
})(this, QueryEditor);
})(this, QueryEditor.default);
</script>
```

Then you can get the query by the options and selectors:

```js
const query = [myQueryEditor.get("options"), ...myQueryEditor.get("selectors")];
const {options, selectors} = myQueryEditor.get();
const query = [options, ...selectors];
```

For a thorough step by step guide to setting up Nymph on your own server, visit the [Setup Guide](https://github.com/sciactive/nymph/wiki/Setup-Guide).
Expand Down

0 comments on commit ac069b3

Please sign in to comment.