Cleanup module
07 May 2016 14:36
10 May 2016 16:33
May be I don't completely understand you, but all JavaScript objects are deleted when the user leaves a web page. The warnings you see in the browser console are simply printed again after the user comes back to your Blend4Web-powered page.
In fact, these warnings are very strange. A simple example blend file and/or source code snippet would be appreciated.
In fact, these warnings are very strange. A simple example blend file and/or source code snippet would be appreciated.
10 May 2016 21:50
The problem is, unlike traditional webpages, the user actually never leaves. HTML is just removed and added using JS. This code is run every time someone visits a page in my app:
Instead of registering "example_main", should I just maybe remove the loaded scene, and load another one when user enters a different page?
b4w.register("example_main", function(exports, require) {
var m_app = require("app");
var m_data = require("data");
exports.init = function() {
m_app.init({
canvas_container_id: "canvas_cont",
callback: init_cb,
physics_enabled: false,
media_auto_activation: false
});
}
function init_cb(canvas_elem, success) {
m_data.load("../"+jsonFile, load_cb);
}
function load_cb(root) {
m_app.enable_camera_controls();
}
});
b4w.require("example_main").init();
Instead of registering "example_main", should I just maybe remove the loaded scene, and load another one when user enters a different page?
11 May 2016 00:12
Okay I managed to solve it using:
It's a documented feature, though very hard to find:
https://www.blend4web.com/api_doc/module-main.html#.reset
b4w.require("main").reset()
It's a documented feature, though very hard to find:
https://www.blend4web.com/api_doc/module-main.html#.reset