Add extension usage instruction

This commit is contained in:
Aaron Nguyen 2022-08-05 13:18:10 -04:00
Родитель 4c03bf020c
Коммит c14219c64c
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -38,11 +38,22 @@ const sampleCircuit = {
2. Draw it in a `div`:
```js
const sampleDiv = document.getElementById('sample');
qviz.draw(sampleCircuit, sampleDiv, qviz.STYLES['Default']);
qviz.create(sampleCircuit)
.draw(sampleDiv)
```
Refer to the [`example`](./example) folder for an example on how to use quantum-viz.js. Notice that in order to open the contents of this folder in a browser you will need first to install from source (see [below](#running-from-source)).
3. Enable extensions by:
```js
const sampleDiv = document.getElementById('sample');
qviz.create(sampleCircuit)
.useDraggble() // drag and drop
.usePanel() // edit and add panel
.useOnCircuitChange(circuit => console.log(circuit)) // trigger when circuit changes
.draw(sampleDiv)
```
## Python usage
To use this package with Python, use [quantum-viz](/quantum-viz).