Skip to content

Loading from a stand alone project

Ioannis Charalampidis edited this page Jun 7, 2016 · 5 revisions

Requirements

You need to download and include in your page the following files:

Each one of these files will create/extend the global JBB namespace. The profiles will be available in the JBB.Profile namespace.

Code Example

// Instantiate binary loader
var loader = new JBB.BinaryLoader("/path/to/bundles");

// Add one or more profiles that used to create your bundles
loader.addProfile( JBB.Profile["three"] );

// Add one or more bundles to load
loader.add("bundle_name.jbb");
loader.add("sparse_bundle_name.jbbp");

// Load all of them and callback when ready
loader.load(function(err, database) {

   // Handle errors
   if (err) {
      alert("Loading error: "+err);
      return;
   }

   // Handle your data here
   var my_object = database["bundle_name/resource_name"];

});

Clone this wiki locally