1.3.0 • Published 4 years ago
@pulpoar/sdk-core v1.3.0
@pulpoar/sdk-core
Core package provide to render pulpoar plugin and communicate with it.
Usage with npm
npm i @pulpoar/sdk-coreCreate a div element anywhere with any id . @pulpoar/sdk-core' using "pulpoar" as default id
<div id="pulpoar"></div>import Core from '@pulpoar/sdk-core';
const core = new Core({
websiteId: 'Your Website Id',
autoStart: false,
targetElementId: 'pulpoar',
});
core.mount();
core.onMounted = () => {
core.start();
};Usage with vanilla javascript
<body>
<div id="pulpoar"></div>
<button onclick="changeScreen(2)">Open Choose Model</button>
<script>
PulpoAR = {
websiteId: 'Your website id',
autoStart: false,
targetElementId: 'pulpoar',
};
PulpoAR.onMounted = () => {
PulpoAR.start();
};
PulpoAR.onError = ({ data }) => {
console.log('error', data);
};
PulpoAR.onStarted = () => {
console.log('PulpoAR started');
};
PulpoAR.onScreenChange = ({ data }) => {
console.log('Screen changed', data);
};
function changeScreen(screen) {
PulpoAR.changeScreen(screen);
}
</script>
<script src="https://cdn.jsdelivr.net/npm/@pulpoar/sdk-core@latest/index.js"></script>
</body>| Params | Description |
|---|---|
| websiteId | Partners web site id |
| autoStart | Starts core automatically |
| targetElementId | element id to render the plugin |
| pluginHeight | Plugin iframe height |
| pluginWidth | Plugin iframe width |
| disableLoader | Hides loader spinner |
| disableError | Hides errors |
| Functions | Description |
|---|---|
| mount | Mounts core |
| start | Starts core |
| stop | Stops core |
| changeScreen | Changes plugin screen |
| Events | Description |
|---|---|
| onMounted | Fires on core mounted |
| onStarted | Fires on core started |
| onError | Fires on core errors |
| onScreenChange | Fires on plugin screen changes |