• function

steal.packages

 

steal.packages( moduleIds... )

Defines modules for deferred downloading.

This is used by the build system to build collections of modules that will be downloaded after initial page load.

For example, an application that wants to progressively load the contents and dependencies of login/login.js, filemanager/filemanager.js, and contacts/contacts.js, while immediately loading the current users's data might look like:

steal.packages('login','filemanager','contacts')
steal('models/user', function(User){

  // get the current User
  User.findOne({id: "current"}, 

    // success - they logged in
    function(user){
      if(window.location.hash == "#filemanager"){
        steal('filemanager')  
      }
    }, 
    // error - they are logged out
    function(){
      steal('login', function(){
        new Login(document.body);
        // preload filemanager

      })  
    })
})


steal.packages('tasks','dashboard','filemanager');

Parameters

  1. moduleIds {Array}

    moduleIds... Each argument is a moduleId that tells the build system to package that module for progressive loading.