summaryrefslogtreecommitdiffstats
path: root/o3d/samples
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 01:13:24 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 01:13:24 +0000
commit64afa1951d58caafa4e0285e1f31c6c6d70f730b (patch)
tree8c585b230cfc232c2d92d9d4b9166a32668986a3 /o3d/samples
parent21fc9dc4cbe2c771e357f4dbed0d2b5131599f8a (diff)
downloadchromium_src-64afa1951d58caafa4e0285e1f31c6c6d70f730b.zip
chromium_src-64afa1951d58caafa4e0285e1f31c6c6d70f730b.tar.gz
chromium_src-64afa1951d58caafa4e0285e1f31c6c6d70f730b.tar.bz2
Add usual cleanup code for this sample, fixing breakage with Firefox's backward / forward cache.
Review URL: http://codereview.chromium.org/164174 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22852 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples')
-rw-r--r--o3d/samples/helloworld.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/o3d/samples/helloworld.html b/o3d/samples/helloworld.html
index 735d710..7c40262 100644
--- a/o3d/samples/helloworld.html
+++ b/o3d/samples/helloworld.html
@@ -57,6 +57,8 @@ o3djs.require('o3djs.scene');
// Events
// init() once the page has finished loading.
window.onload = init;
+// unload() when leaving the page.
+window.onunload = unload;
// global variables
var g_o3d;
@@ -119,6 +121,15 @@ function init() {
}
/**
+ * Remove any callbacks so they don't get called after the page has unloaded.
+ */
+function unload() {
+ if (g_client) {
+ g_client.cleanup();
+ }
+}
+
+/**
* Initializes O3D and loads the scene into the transform graph.
* @param {Array} clientElements Array of o3d object elements.
*/