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)
|
return plugin._output = plugin[type] = can.Output(plugin, feature, type, msg, cb, output, option)
|
||||||
},
|
},
|
||||||
Clone: function(event, cb) {meta.nick = meta.name + can.ID()
|
Clone: function(event, cb) {meta.nick = meta.name + can.ID()
|
||||||
can.Plugin(can, meta.nick, meta, run,
|
meta.args = can.page.Select(can, plugin.option, ".args", function(item) {return item.value})
|
||||||
can.page.AppendField(can, field.parentNode, "item "+meta.group+" "+meta.nick, meta), cb)
|
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)},
|
Delete: function(event) {field.parentNode.removeChild(field)},
|
||||||
}, Config.libs.concat(["plugin/"+(meta.type||feature.active||"state")]), function(plugin) {plugin.Conf(meta);
|
}, 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")
|
chat.Login.Import(event||{}, "", "login")
|
||||||
}, document.body)
|
}, document.body)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="/static/volcanos/style.css">
|
<link rel="stylesheet" type="text/css" href="/static/volcanos/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<script src="/static/volcanos/lib/wasm.js"></script>
|
||||||
<script src="/static/volcanos/proto.js"></script>
|
<script src="/static/volcanos/proto.js"></script>
|
||||||
<script src="/static/volcanos/order.js"></script>
|
<script src="/static/volcanos/order.js"></script>
|
||||||
<script src="/static/volcanos/frame.js"></script>
|
<script src="/static/volcanos/frame.js"></script>
|
||||||
|
@ -255,6 +255,10 @@ Volcanos("page", {help: "网页模块",
|
|||||||
|
|
||||||
Display: function(text) {
|
Display: function(text) {
|
||||||
if (text.startsWith("http")) {return "<a href='"+text+"' target='_blank'>"+text+"</a>"}
|
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;
|
return text;
|
||||||
},
|
},
|
||||||
CopyText: function(can, text) {
|
CopyText: function(can, text) {
|
||||||
|
@ -10,7 +10,7 @@ Volcanos("onimport", {help: "导入数据", list: [],
|
|||||||
case "TD":
|
case "TD":
|
||||||
can.onimport.which(event, table, msg.append, function(index, key) {
|
can.onimport.which(event, table, msg.append, function(index, key) {
|
||||||
can.ondetail["复制"](event, can, msg, event.target.innerHTML, index, key, event.target);
|
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
|
break
|
||||||
case "TH":
|
case "TH":
|
||||||
|
13
proto.js
13
proto.js
@ -208,10 +208,21 @@ function Volcanos(name, can, libs, cb, msg) { // 封装模块
|
|||||||
can.load(libs[0]), next()
|
can.load(libs[0]), next()
|
||||||
} else {
|
} else {
|
||||||
// 加载脚本
|
// 加载脚本
|
||||||
can.Dream(document.body, libs[0]+".js", function() {
|
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();
|
can.load(libs[0]), next();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 独立模块
|
// 独立模块
|
||||||
next()
|
next()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user