forked from x/ContextOS
opt volcanos.js
This commit is contained in:
parent
40b6b437a4
commit
880cb94dd3
@ -97,7 +97,8 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
||||
},
|
||||
map[string]interface{}{"name": "tail",
|
||||
"tmpl": "tail", "scripts": []interface{}{
|
||||
"volcanos.js", "toolkit.js", "context.js", "example.js", "chat.js",
|
||||
"toolkit.js", "context.js", "example.js", "chat.js",
|
||||
"can_proto.js", "can_frame.js",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
1
usr/librarys/can_frame.js
Symbolic link
1
usr/librarys/can_frame.js
Symbolic link
@ -0,0 +1 @@
|
||||
../volcanos/frame.js
|
1
usr/librarys/can_proto.js
Symbolic link
1
usr/librarys/can_proto.js
Symbolic link
@ -0,0 +1 @@
|
||||
../volcanos/proto.js
|
@ -23,7 +23,7 @@ ctx = context = (function(kit) {var ctx = {__proto__: kit,
|
||||
kit.History("run", -1, option)
|
||||
this.POST("", option, function(msg) {
|
||||
kit.Log("run", what, "result", msg.result? msg.result[0]: "", msg)
|
||||
kit._call(cb, [msg])
|
||||
typeof cb == "function" && cb(msg)
|
||||
}, msg), delete(event.msg)
|
||||
}),
|
||||
Event: shy("封装事件", {order: 0}, function(event, msg, proto) {
|
||||
@ -163,7 +163,7 @@ ctx = context = (function(kit) {var ctx = {__proto__: kit,
|
||||
var res = {"result": [xhr.responseText]}
|
||||
}
|
||||
|
||||
kit._call(cb, [msg.Copy(res)])
|
||||
typeof cb == "function" && cb(msg.Copy(res))
|
||||
}
|
||||
|
||||
xhr.open("POST", url)
|
||||
|
@ -684,6 +684,11 @@ function Pane(page, field) {
|
||||
if (type == "plugin" && line.name || type == "field") {
|
||||
page.Require(line.init? line.group+"/"+line.init: "", function(init) {
|
||||
page.Require(line.view? line.group+"/"+line.view: "", function(view) {
|
||||
can.user.carte = page.carte.Pane.Show
|
||||
can.user.toast = page.toast.Pane.Show
|
||||
line.group == "favor" && can.Plugin(can, ui.item.Meta, function(event, cmds, cbs) {
|
||||
ctx.Run(event, option.dataset, [line.river, line.storm, line.action].concat(cmds), cbs)
|
||||
}, ui.item) ||
|
||||
pane.Plugin(page, pane, ui.item, init, function(event, cmds, cbs) {
|
||||
kit._call(cb||pane.Core, [event, line, cmds, cbs])
|
||||
})
|
||||
@ -987,7 +992,7 @@ function Pane(page, field) {
|
||||
},
|
||||
}
|
||||
|
||||
var Meta = plugin && plugin.target && plugin.target.Meta || {}
|
||||
var Meta = plugin && plugin.target && plugin.target.Meta || line || {}
|
||||
kit.Log(["cmd"].concat(kit.List([Meta.river, Meta.storm, Meta.action])).concat(args[0] == "_cmd"? args[1]: args))
|
||||
|
||||
page.Status("ncmd", kit.History("cmd", -1, {args: args, meta: Meta}))
|
||||
@ -1030,6 +1035,7 @@ function Pane(page, field) {
|
||||
kit.Item(pane.Listen, function(key, cb) {page.Sync(key).change(cb)})
|
||||
return page[name] = field, field.Pane = pane
|
||||
}
|
||||
|
||||
function Plugin(page, pane, field, inits, runs) {
|
||||
var option = field.querySelector("form.option")
|
||||
var action = field.querySelector("div.action")
|
||||
@ -1703,39 +1709,3 @@ function Output(plugin, type, msg, cb, target, option) {
|
||||
return plugin.Outputs[type] = target, target.Output = output
|
||||
}
|
||||
|
||||
var can = Volcanos("chat", {
|
||||
Plugin: shy("构造插件", function(can) {}),
|
||||
Output: shy("构造组件", function(can, plugin, type, msg, cb, target, option) {
|
||||
type = "table"
|
||||
var output = Volcanos(type, {
|
||||
user: can.user, node: can.node,
|
||||
core: can.core, type: can.type,
|
||||
oncarte: plugin.oncarte,
|
||||
run: plugin.run,
|
||||
size: function(cb) {
|
||||
plugin.onfigure.meta.size(function(width, height) {
|
||||
cb(width, height)
|
||||
})
|
||||
}
|
||||
}, [type], function(output) {
|
||||
target.oncontextmenu = function(event) {
|
||||
plugin.oncarte(event, shy("", output.onchoice, output.onchoice.list, function(event, value, meta) {
|
||||
typeof meta[value] == "function"? meta[value](event, can, msg, cb, target, option):
|
||||
typeof output[value] == "function"? output[value](event, can, msg, cb, target, option):
|
||||
typeof plugin[value] == "function"? plugin[value](event, can, msg, cb, target, option): null
|
||||
return true
|
||||
}))
|
||||
event.stopPropagation()
|
||||
event.preventDefault()
|
||||
return true
|
||||
}
|
||||
output.load().onimport.init(output, msg, cb, target, option)
|
||||
})
|
||||
kit.Item(output.onaction, function(key, cb) {target[key] = function(event) {
|
||||
output.onaction(event, can, msg, cb, target, option)
|
||||
}})
|
||||
plugin[type] = output, output.target = target, target.Output = output
|
||||
}),
|
||||
Input: shy("构造控件", function(can, plugin, type, meta, target, option) {
|
||||
}),
|
||||
}, [], function(can) {can.load()})
|
||||
|
@ -1 +0,0 @@
|
||||
../volcanos/volcanos.js
|
@ -1,17 +1,60 @@
|
||||
# {{title "Volcanos.js"}}
|
||||
|
||||
volcanos是一个前端框架。
|
||||
模块化
|
||||
通过建立脚本的依赖关系,按需加载相关文件,从而更加高效的组织项目文件。
|
||||
通过组件化方式设计功能模块,每个模块都是一个独立完整的运行单元。
|
||||
通过插件化方式加载功能模块,每个模块都有框架与输入与输出。
|
||||
通过模块化方式管理模块依赖,可以动态按需加载各种模块。
|
||||
|
||||
{{chart "chain" `
|
||||
Volcanos
|
||||
Volcanos
|
||||
Volcanos
|
||||
Volcanos
|
||||
chat
|
||||
proto
|
||||
"ID 生成器"
|
||||
"Log 日志器"
|
||||
"Conf 配置器"
|
||||
"Sync 同步器"
|
||||
"Timer 定时器"
|
||||
"Event 触发器"
|
||||
"Dream 构造器"
|
||||
"Cache 缓存器"
|
||||
"Story 存储器"
|
||||
|
||||
Plugin
|
||||
Inputs
|
||||
"onimport 导入数据"
|
||||
"onaction 控件交互"
|
||||
"onchoice 控件菜单"
|
||||
"ondetail 控件详情"
|
||||
"onexport 导出数据"
|
||||
Output
|
||||
|
||||
"base 基础模块"
|
||||
"core 核心模块"
|
||||
"misc 工具模块"
|
||||
"page 网页模块"
|
||||
"user 用户模块"
|
||||
|
||||
`}}
|
||||
|
||||
## {{section "type模块"}}
|
||||
## {{section "core模块"}}
|
||||
## {{section "node模块"}}
|
||||
## {{section "misc模块"}}
|
||||
## {{section "device模块"}}
|
||||
## {{chapter "原型"}}
|
||||
### {{section "ID 生成器"}}
|
||||
### {{section "Log 日志器"}}
|
||||
### {{section "Conf 配置器"}}
|
||||
### {{section "Sync 同步器"}}
|
||||
### {{section "Timer 定时器"}}
|
||||
### {{section "Event 触发器"}}
|
||||
### {{section "Dream 构造器"}}
|
||||
### {{section "Cache 缓存器"}}
|
||||
### {{section "Story 存储器"}}
|
||||
|
||||
## {{chapter "框架"}}
|
||||
### {{section "Plugin 插件"}}
|
||||
### {{section "Inputs 控件"}}
|
||||
### {{section "Output 组件"}}
|
||||
|
||||
## {{chapter "模块"}}
|
||||
### {{section "base 模块"}}
|
||||
### {{section "core 模块"}}
|
||||
### {{section "misc 模块"}}
|
||||
### {{section "page 模块"}}
|
||||
### {{section "user 模块"}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user