这篇文章给出一个完整的例子, 用于测试自己生成的plugin 插件。
<head>
<script type="text/javascript">
function testDynamicPlugin() {
var elem = document.createElement("embed");
elem.id = "example-plugin";
elem.type = "application/x-kreatell-toi";
//elem.type = "application/x-kreatell-example-plugin";
elem.setAttribute("hidden", "false");
elem.width = 400;
elem.height = 400;
document.body.appendChild(elem);
// this wrokaround can work for toi on webkit537,
// but now this workaround cannot work for webkit600.
document.body.offsetWidth;
var example-plugin = document.getElementById("example-plugin");
alert("====teletext Object===" + example-plugin);
// Check whether this code line will throw erro or not in log.
example-plugin.active = false;
alert("====Success to set example-plugin acitce property==");
var gPluginVersion = document.getElementById("example-plugin").version;
//console.log("==========toi.mediaService.REASON_COMMAND_OPEN=" + toi.mediaService.REASON_COMMAND_OPEN);
console.log("==========gPluginVersion=" + gPluginVersion);
// Check whether this code line will throw erro or not in log.
//example-plugin.tick();
//alert("====Success to call example-plugin tick()==");
var networkConf = toi.netService.getConfiguration();
//plugin.flofGreenKey()
alert("test dynamic plugins");
}
catch (e) {
alert("Exception :" + e);
}
}
</script>
</head>
<body onload="testDynamicPlugin();" style="background-color: white">
<p>Test toi plugin is dynamically loaded or not.</p>
</body>
</html>
本文提供了一个完整的例子,用于验证自定义生成的plugin插件的加载与基本操作。
928

被折叠的 条评论
为什么被折叠?



