Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Resorce loading feature

    It would be nice to have a feature for showing a progress screen and load scripts and/or other resources assynchronous on the fly.

    Script resources could also be automatically appended to the document.

    The idea is that all the resources including isomorphic API could be loaded before the application starts and the progress shown to the user.

    Something like this:

    Code:
    <html>
        <head>
           <script src="./isomorphic/system/modules/ISC_ResourceLoader.js"></script>
           <script>
                window.onload = function() 
                {
                     var loader = isc.ResourceLoader.create
                          ({
                                  showLoadingScreen : true,
                                  autoInstallScripts : true,
    
                                  resources : 
                                  [
                                      { name : "license" url : "./license.txt", type : "plain_text"},
                                      { name : "isomorphic_core", url : "./isomorphic/system/modules/ISC_Core.js", type : "script"},
                                      { name : "validator", url : "./scripts/my_custom_validation.js", type : "script"}
                                  ]
    
                                  resourceLodaded : function (name, url, type, data, totalProgress)
                                  { 
                                         if (name == "license")
                                            confirm(data);
                                  },
    
                                  onComplete : function()
                                  {
                                        isc.Window.create
                                        ({
                                              width : 200, height : 150, autoCenter : true,
                                              items : 
                                              [
                                                     isc.Label.create({contents : "All files were loaded correctly!"});
                                              ]
                                        });
                                  },
                                
                                  onError : function(name, url, type, errorCode)
                                  {
                                        if ((errorCode == 404) && (name == "isomorphic_core"))
                                       {
                                           alert("The isomorphic core API wasn't found! You can continue using this application but some features will not be available!");
                                       }
                                  }
                          });
      
                          loader.start();
                }
           </script>
        </head>
        <body>
        </body>
    </html>

    #2
    See FileLoader for SmartClient, and the .html file for loading the SmartGWT Showcase (which is a straight-to-the-browser progress indicator implementation).

    Comment


      #3
      Thank you!
      I'll take a look!

      Comment

      Working...
      X