Forum

Empty Function

11 October 2015 11:46
I am working on commenting the code for a basic app.

"use strict";                                // forces this code to execute in strict mode, no undeclared variables

                                             // The following variables are loaded with abilities from the main blen4web engine. 
                                             // For details, open your SDK from within Blender and plug in the URL provided below

var app = b4w.require("app");                // localhost:6687/deploy/api_doc/module-app.html
var data = b4w.require("data");              // localhost:6687/deploy/api_doc/module-data.html


app.init({                                   // this executes the function to start up the app and loads it into the div with the id of "background_app"
    canvas_container_id: "background_app",
    physics_enabled: false,
    autoresize: true,
    callback: load_cb
});
	
function load_cb() {                         // this creates the function that loads the data from your JSON file
data.load("hello_world.json", loaded_cb);

}
	
function loaded_cb() {                       
		
}

What does that last function, loaded_cb do? Is it to let the player know the app has loaded?
11 October 2015 15:58
Hi Will!
What does that last function, loaded_cb do? Is it to let the player know the app has loaded?
Yes! To be more exact, this is a callback which is executed when the SCENE is loaded (hello_world.json). App developers are supposed to start manipulating 3D objects there.
The Founder | Twitter | Facebook | Linkedin
11 October 2015 18:00
Okay, great. I will put that information in.
 
Please register or log in to leave a reply.