JSFiddle - React, Tailwind, and code Playground
by fxi
HTML
<script src="https://unpkg.com/@fxi/[email protected]/dist/mxsdk.umd.js"></script>
JavaScript
/**
* new mxsdk instance
*/
const manager = new mxsdk.Manager({
url: 'https://app.mapx.org?project=MX-YBJ-YYF-08R-UUR-QW6&language=en'
});
window.mx = manager;
/**
* When ready, begin requests
*/
manager.on('ready', () => {
/**
* Get list of views, print them in console
*/
manager.ask('get_views').then(console.log);
/**
* Get geo ip info, print it in console
*/
manager.ask('get_ip').then(console.log);
setTimeout(()=>{
/**
* Change project after 3000 ms, print new list
* of views
*/
manager.ask('set_project','MX-FBK-1Z9-6O9-KV2-KFR')
.then(manager.ask('get_views'))
.then(console.log)
}, 3000);
});