mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
add wasm
This commit is contained in:
parent
63a48dcd8a
commit
018ac85552
6
frame.js
6
frame.js
@ -195,8 +195,9 @@ var can = Volcanos("chat", {
|
||||
return plugin._output = plugin[type] = can.Output(plugin, feature, type, msg, cb, output, option)
|
||||
},
|
||||
Clone: function(event, cb) {meta.nick = meta.name + can.ID()
|
||||
can.Plugin(can, meta.nick, meta, run,
|
||||
can.page.AppendField(can, field.parentNode, "item "+meta.group+" "+meta.nick, meta), cb)
|
||||
meta.args = can.page.Select(can, plugin.option, ".args", function(item) {return item.value})
|
||||
can._plugins.push(can.Plugin(can, meta.nick, meta, run,
|
||||
can.page.AppendField(can, field.parentNode, "item "+meta.group+" "+meta.nick, meta), cb))
|
||||
},
|
||||
Delete: function(event) {field.parentNode.removeChild(field)},
|
||||
}, Config.libs.concat(["plugin/"+(meta.type||feature.active||"state")]), function(plugin) {plugin.Conf(meta);
|
||||
@ -257,4 +258,3 @@ var can = Volcanos("chat", {
|
||||
chat.Login.Import(event||{}, "", "login")
|
||||
}, document.body)
|
||||
})
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/static/volcanos/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<script src="/static/volcanos/lib/wasm.js"></script>
|
||||
<script src="/static/volcanos/proto.js"></script>
|
||||
<script src="/static/volcanos/order.js"></script>
|
||||
<script src="/static/volcanos/frame.js"></script>
|
||||
|
@ -255,6 +255,10 @@ Volcanos("page", {help: "网页模块",
|
||||
|
||||
Display: function(text) {
|
||||
if (text.startsWith("http")) {return "<a href='"+text+"' target='_blank'>"+text+"</a>"}
|
||||
text = text.replace(/\033\[31m/g, "<span style='color:#f00'>")
|
||||
text = text.replace(/\033\[32m/g, "<span style='color:#0f0'>")
|
||||
text = text.replace(/\033\[0m/g, "</span>")
|
||||
text = text.replace(/\033\[m/g, "</span>")
|
||||
return text;
|
||||
},
|
||||
CopyText: function(can, text) {
|
||||
|
@ -10,7 +10,7 @@ Volcanos("onimport", {help: "导入数据", list: [],
|
||||
case "TD":
|
||||
can.onimport.which(event, table, msg.append, function(index, key) {
|
||||
can.ondetail["复制"](event, can, msg, event.target.innerHTML, index, key, event.target);
|
||||
can.Export(event, event.target.innerHTML, key, index)
|
||||
can.Export(event, event.target.innerHTML.trim(), key, index)
|
||||
})
|
||||
break
|
||||
case "TH":
|
||||
|
17
proto.js
17
proto.js
@ -208,9 +208,20 @@ function Volcanos(name, can, libs, cb, msg) { // 封装模块
|
||||
can.load(libs[0]), next()
|
||||
} else {
|
||||
// 加载脚本
|
||||
can.Dream(document.body, libs[0]+".js", function() {
|
||||
can.load(libs[0]), next();
|
||||
})
|
||||
if (libs[0].indexOf(".") == -1) {libs[0] += ".js"}
|
||||
if (libs[0].endsWith(".wasm")) {var go = new Go();
|
||||
WebAssembly.instantiateStreaming(fetch(libs[0]), go.importObject).then((result) => {
|
||||
go.argv = [can];
|
||||
go.run(result.instance);
|
||||
next();
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
can.Dream(document.body, libs[0], function() {
|
||||
can.load(libs[0]), next();
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 独立模块
|
||||
|
Loading…
x
Reference in New Issue
Block a user