@@ -161,8 +161,8 @@ canvas.emscripten | |||||
Module.setStatus('Please wait, calculating load balance ...', 0, 1); | Module.setStatus('Please wait, calculating load balance ...', 0, 1); | ||||
//Module <-> Page communication setup | //Module <-> Page communication setup | ||||
var cur_obj = (parent) ? (parent) : (this); | var cur_obj = (parent) ? (parent) : (this); | ||||
cur_obj.g_embed_em_module = Module; | |||||
cur_obj.SendMessageToModule = function() { this.g_embed_em_module.SendMessage(this.GetTextAreaCodeSrc().value); }; | |||||
cur_obj.g_embed_module = Module; | |||||
cur_obj.SendMessageToModule = function() { this.g_embed_module.SendMessage(this.GetTextAreaCodeSrc().value); }; | |||||
cur_obj.ModuleSentMessage = function(message) { /* */ }; | cur_obj.ModuleSentMessage = function(message) { /* */ }; | ||||
</script> | </script> | ||||
@@ -1,5 +1,6 @@ | |||||
<DOCTYPE html> | <DOCTYPE html> | ||||
<html> | <html> | ||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> | |||||
<!-- | <!-- | ||||
Copyright (c) 2012 The Native Client Authors. All rights reserved. | Copyright (c) 2012 The Native Client Authors. All rights reserved. | ||||
@@ -100,6 +101,9 @@ progress::-webkit-progress-value | |||||
g_progress_bar = null; | g_progress_bar = null; | ||||
g_var_progress_bar = -1; | g_var_progress_bar = -1; | ||||
g_frame_embed = null; | g_frame_embed = null; | ||||
//This is the module pointer : can be either the NaCl or Em one depending on the context. | |||||
g_embed_module = null; | |||||
function GetTextAreaCodeSrc() { return g_txtarea_code_src; } | function GetTextAreaCodeSrc() { return g_txtarea_code_src; } | ||||
function GetDivProgress() { return g_div_progress; } | function GetDivProgress() { return g_div_progress; } | ||||
@@ -1,8 +1,6 @@ | |||||
g_embed_nacl_module = null; | |||||
if (IsUsingNaCl()) NaClLoadingInit(); | if (IsUsingNaCl()) NaClLoadingInit(); | ||||
function InitNaClModuleVar() { g_embed_nacl_module = GetiFrameModuleVar(); } | |||||
function InitNaClModuleVar() { g_embed_module = GetiFrameModuleVar(); } | |||||
function RegisterListener() | function RegisterListener() | ||||
{ | { | ||||
@@ -30,7 +28,7 @@ function NaClLoadingInit() | |||||
{ | { | ||||
HideProgressStatus(false); | HideProgressStatus(false); | ||||
//Page did load before NaCl module | //Page did load before NaCl module | ||||
if (!g_embed_nacl_module) | |||||
if (!g_embed_module) | |||||
AddTextStatus('Please wait for module loading'); | AddTextStatus('Please wait for module loading'); | ||||
RegisterListener(); | RegisterListener(); | ||||
} | } | ||||
@@ -54,7 +52,7 @@ function ModuleLoadUpdate(event) | |||||
//Indicate module load success. | //Indicate module load success. | ||||
function ModuleDidLoad() | function ModuleDidLoad() | ||||
{ | { | ||||
if (!g_embed_nacl_module) | |||||
if (!g_embed_module) | |||||
InitNaClModuleVar(); | InitNaClModuleVar(); | ||||
//Hide the progress div | //Hide the progress div | ||||
@@ -100,8 +98,8 @@ function ModuleSentMessage(message) | |||||
//Called by the "Send Mesh Command !" button | //Called by the "Send Mesh Command !" button | ||||
function SendMessageToModule() | function SendMessageToModule() | ||||
{ | { | ||||
if (g_embed_nacl_module) | |||||
g_embed_nacl_module.postMessage(GetTextAreaCodeSrc().value); | |||||
if (g_embed_module) | |||||
g_embed_module.postMessage(GetTextAreaCodeSrc().value); | |||||
else | else | ||||
alert("Module not loaded !"); | alert("Module not loaded !"); | ||||
} | } |