Reemo.js
 
                    This reference documents every object and method available in Reemo's browser-side JavaScript library, Reemo.js
                    
                    You use Reemo.js to display a plug and play Low Latency Remote Desktop Streaming WebClient to your website and access your computers registered to the Reemo API.
                 
 Including Reemo.js
                Include the Reemo.js script on your website, it should always be loaded directly from 
https://static.reemo.io/reemo.min.js, rather than included in a bundle or hosted yourself.
                
Including Reemo.js
                    <script src="https://static.reemo.io/reemo.min.js"></script>
                
 new Reemo.WebClient()
                Use 
new Reemo.WebClient() to create an instance of the 
Reemo WebClient object.
                  
                    Please note that your page must not have more than one WebClient existing at anytime.
                
 // Initializing Reemo.js
                    const reemo = new Reemo.WebClient();
                
 init(element_id, options?)
                Use 
init(element_id, options?) to init the 
Reemo WebClient DOM.
                
Create a DOM element on your page to receive the Reemo WebClient DOM
                    <div id="reemodiv"></div>
                
// Initializing the DOM
                    reemo.init('reemodiv');
                
Method Parameters
  Options Parameter
  
 connect(computer)
                When you are ready use 
connect(computer) to initialize the connection to the remote computer.
                
computer is provided by the 
Reemo API and contains the computer object with a fresh access token to allow access on our signal servers.
                Read the 
Reemo API documentation for more info.
                
// Connect to the computer provided by your website's API (connected to the Reemo API)
                    reemo.connect(computer);
                
Method Parameters
  
 destroy()
                When you are done with the WebClient, you can destroy it manually by calling 
destroy() to remove it from the DOM. 
                This will trigger the 
beforeDestroy event. After calling the 
destroy() method, you must not reuse the WebClient object or hold reference to it.
                You can then safely create another WebClient by calling 
new Reemo.WebClient().
                  
                    Please note that your page must not have more than one WebClient existing at anytime.
                
 // Destroy the WebClient and remove it from the DOM
                    reemo.destroy();
                
 Listening to Events
                The 
Reemo WebClient object emits events during all of its lifetime to report DOM and connection events.
                
created
                Emitted after the Reemo WebClient has been initialized and the DOM is ready.
                
// The DOM is ready
reemo.on('created', () => {
    console.log('WebClient created');
}); beforeDestroy
                Emitted just before the 
Reemo WebClient DOM and listeners are beeing removed from the page.
                
// The DOM is about to get destroyed
reemo.on('beforeDestroy', () => {
    console.log('WebClient is beeing destroyed');
}); state
                Emitted after every connection state change.
                
// Connection state changed
reemo.on('state', ({state, error}) => {
    console.log(`State Changed: ${state}, Error: ${error}`);
}); Event Properties
  States List
  back
                Emitted when the user clicked on the 
Back button. This event may only happen if the 
backButton 
                option is set to 
true in the 
init(element_id, options?) method options. This event is commonly used
                to get back to the previous page on your webapp.
                
// The Back button has been pressed
reemo.on('back', () => {
    console.log('back button pressed');
}); retry
                Emitted when the user clicked on the 
Retry button. This event may only happen if the 
retryButton 
                option is set to 
true in the 
init(element_id, options?) method options. This event gives you an opportunity to fetch
                a new computer token on the 
Reemo API and call 
connect(computer) method again.
                
// The Retry button has been pressed
reemo.on('retry', () => {
    console.log('retry button pressed');
}); 
 Full Example
                     Full Example
<div id="reemodiv"></div>
<script src="https://static.reemo.io/reemo.min.js"></script>
<script>
    function onExtraAction() {
        console.log('extra action clicked');
    }
    window.onload = () => {
        // Initialize Reemo.js
        const reemo = new Reemo.WebClient();
        // Events
        reemo.on('created', () => {
            console.log('WebClient created');
        });
        reemo.on('beforeDestroy', () => {
            console.log('WebClient is beeing destroyed');
        });
        reemo.on('state', ({state, error}) => {
            console.log(`State Changed: ${state}, Error: ${error}`);
        });
        reemo.on('back', () => {
            console.log('back button pressed');
        });
        reemo.on('retry', () => {
            console.log('retry button pressed');
        });
        // Initialize the DOM
        reemo.init('reemodiv', {
            backButton: true,
            retryButton: true,
            extraMenu: [{
                label: 'Extra Options',
                type: 'options',
                options: [{
                    label: 'Extra Option',
                    type: 'action',
                    action: onExtraAction,
                }]
            }, {
                label: 'Reemo.io',
                type: 'link',
                link: 'https://reemo.io',
            }]
        });
        // Connect to the computer provided by your website's API (connected to the Reemo API)
        reemo.connect(computer);
    };
</script>