瀏覽代碼

Html : Added Embed Module var in main html so compatibility is ensured.

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 11 年之前
父節點
當前提交
0fda9a304b
共有 3 個文件被更改,包括 11 次插入9 次删除
  1. +2
    -2
      src/platform/emscripten/lol_shell.html
  2. +4
    -0
      test/meshviewer_index.html
  3. +5
    -7
      test/nacl_loading.js

+ 2
- 2
src/platform/emscripten/lol_shell.html 查看文件

@@ -161,8 +161,8 @@ canvas.emscripten
Module.setStatus('Please wait, calculating load balance ...', 0, 1);
//Module <-> Page communication setup
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) { /* */ };
</script>



+ 4
- 0
test/meshviewer_index.html 查看文件

@@ -1,5 +1,6 @@
<DOCTYPE html>
<html>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />

<!--
Copyright (c) 2012 The Native Client Authors. All rights reserved.
@@ -100,6 +101,9 @@ progress::-webkit-progress-value
g_progress_bar = null;
g_var_progress_bar = -1;
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 GetDivProgress() { return g_div_progress; }


+ 5
- 7
test/nacl_loading.js 查看文件

@@ -1,8 +1,6 @@
g_embed_nacl_module = null;

if (IsUsingNaCl()) NaClLoadingInit();

function InitNaClModuleVar() { g_embed_nacl_module = GetiFrameModuleVar(); }
function InitNaClModuleVar() { g_embed_module = GetiFrameModuleVar(); }

function RegisterListener()
{
@@ -30,7 +28,7 @@ function NaClLoadingInit()
{
HideProgressStatus(false);
//Page did load before NaCl module
if (!g_embed_nacl_module)
if (!g_embed_module)
AddTextStatus('Please wait for module loading');
RegisterListener();
}
@@ -54,7 +52,7 @@ function ModuleLoadUpdate(event)
//Indicate module load success.
function ModuleDidLoad()
{
if (!g_embed_nacl_module)
if (!g_embed_module)
InitNaClModuleVar();

//Hide the progress div
@@ -100,8 +98,8 @@ function ModuleSentMessage(message)
//Called by the "Send Mesh Command !" button
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
alert("Module not loaded !");
}

Loading…
取消
儲存