1.3.0 • Published 2 years ago

@pulpoar/sdk-core v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

@pulpoar/sdk-core

Core package provide to render pulpoar plugin and communicate with it.

Usage with npm

npm i @pulpoar/sdk-core

Create 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>
ParamsDescription
websiteIdPartners web site id
autoStartStarts core automatically
targetElementIdelement id to render the plugin
pluginHeightPlugin iframe height
pluginWidthPlugin iframe width
disableLoaderHides loader spinner
disableErrorHides errors

FunctionsDescription
mountMounts core
startStarts core
stopStops core
changeScreenChanges plugin screen

EventsDescription
onMountedFires on core mounted
onStartedFires on core started
onErrorFires on core errors
onScreenChangeFires on plugin screen changes
1.3.0

2 years ago

1.2.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1-alpha.0

2 years ago

1.0.0

2 years ago