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

Commit

Permalink
Updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Nov 21, 2017
1 parent 53dc1b5 commit 299f8a8
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,36 @@ This repository is the JavaScript query editor widget built with Svelte. For mor
npm install --save nymph-query-editor
```

To use, include the file from either the UMD, CommonJS, or IIFE lib folder, and instantiate with a target and list of Nymph entity classes:

```js
var myQueryEditor = new HelloWorld({
target: document.querySelector('query-editor'),
data: {
supportedClasses: [
MyFirstEntity,
MySecondEntity
],
options: {
"class": MyFirstEntity.class
},
selectors: [
{
"type": "&",
"gte": ["cdate", null, "-1 week"]
To use, include the files from the lib folder, and instantiate with a target and list of Nymph entity classes:

```html
<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: {
supportedClasses: [
MyFirstEntity,
MySecondEntity
],
options: {
"class": MyFirstEntity.class
},
selectors: [
{
"type": "&",
"gte": ["cdate", null, "-1 week"]
}
]
}
]
}
});
});
})(this, QueryEditor);
</script>
```

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

0 comments on commit 299f8a8

Please sign in to comment.