Top

Rainbow Web Sdk Issue After Update

Comments

3 comments

  • Konrad Hyzy

    Hi,

     

    You might want to have a look at the new guide explaining how to load Rainbow Web SDK as a ES Module: https://hub.openrainbow.com/#/documentation/doc/sdk/web/guides/Hello_world_ESM

     

    Best Regards,

    Konrad

     

    0
    Comment actions Permalink
  • Scott

    Hi Konrad,

    I have used above document link to create new application using Angular and getting below error.

    index.html : 

    <!DOCTYPE HTML>
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <meta http-equiv="X-UA-Compatible" content="IE=edge" />
            <meta name="viewport" content="width=device-width, initial-scale=1" />
            <title>My First Rainbow Application</title>
            <script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-shim.min.js"></script>
            <script src="//cdnjs.cloudflare.com/ajax/libs/es6-promise/4.0.5/es6-promise.min.js"></script>
            <script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
            <script src="//cdn.jsdelivr.net/momentjs/2.15.1/moment-with-locales.min.js"></script>
            <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
            <script src="node_modules/rainbow-web-sdk/src/loader-sdk.min.js" data-main="./config.json"></script>
            <script type="module" src="./index.js"></script>
        </head>
        <body>
            <h1>Rainbow Hello World Application</h1>
        </body>
    </html>

     

    index.js

    /* Chose one of the import statement below */
    import rainbowSDK from '/node_modules/rainbow-web-sdk/src/rainbow-sdk.min.js'; // If you do not use the bundler


    var onReady = function onReady() {
        console.log('[Hello World] :: On SDK Ready !');
    };

    var onLoaded = function onLoaded() {
        console.log('[Hello World] :: On SDK Loaded !');

        rainbowSDK
            .initialize('2a41bdc0966b11ea907e6f42c1248a7b', 'J8ActOQSAkY0RpOPNfsnWkcYkcpm9TWFpL29Yhol8SGu0i7YWNWxce0EbTDj5bsD')
            .then(() => {
                console.log('[Hello World] :: Rainbow SDK is initialized!');
            })
            .catch(err => {
                console.log('[Hello World] :: Something went wrong with the SDK.', err);
            });
    };
    document.addEventListener(rainbowSDK.RAINBOW_ONREADY, onReady);

    document.addEventListener(rainbowSDK.RAINBOW_ONLOADED, onLoaded);
    rainbowSDK.start();
    rainbowSDK.load();
     

    Error : 

    Please help me on this.

     

    Regards,

    Scott

    0
    Comment actions Permalink
  • Konrad Hyzy

    Hi,

     

    I don't see the following script tag in your HTML file. Try adding it.

     

     <script src="./vendors-sdk.min.js"></script>
    0
    Comment actions Permalink

Please sign in to leave a comment.

Still can't find what you need?

  • Contact Us

    Do you have any question about Rainbow? Leave us a message to get more information.

    Contact
  • Ask the Community

    Do you need help? Ask your questions in the Community to get answers from other Rainbow users.

    Post message