mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
add demo
This commit is contained in:
parent
ae69519f72
commit
ada5587521
14
page/demo.html
Normal file
14
page/demo.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=0.7,user-scalable=no">
|
||||||
|
<title>volcanos</title>
|
||||||
|
|
||||||
|
<link rel="shortcut icon" type="image/ico" href="favicon.ico">
|
||||||
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script src="proto.js"></script>
|
||||||
|
<script src="demo.js"></script>
|
||||||
|
</body>
|
||||||
|
|
5
page/demo.js
Normal file
5
page/demo.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Volcanos("demo", {head: document.head, body: document.body, target: document.body,
|
||||||
|
}, ["plugin/table.js"], function(can) {
|
||||||
|
can.target.style.background = "black"
|
||||||
|
console.log(can)
|
||||||
|
})
|
1
page/favicon.ico
Symbolic link
1
page/favicon.ico
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../favicon.ico
|
1
page/plugin
Symbolic link
1
page/plugin
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../plugin
|
1
page/proto.js
Symbolic link
1
page/proto.js
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../proto.js
|
1
page/style.css
Symbolic link
1
page/style.css
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../style.css
|
15
proto.js
15
proto.js
@ -1,7 +1,7 @@
|
|||||||
// volcanos: 前端 火山架 我看不行
|
// volcanos: 前端 火山架 我看不行
|
||||||
// FMS: a fieldset manager system
|
// FMS: a fieldset manager system
|
||||||
|
|
||||||
function shy(help, meta, list, cb) { // 封装函数
|
function shy(help, meta, list, cb) {
|
||||||
var index = -1, value = "", type = "string", args = arguments;
|
var index = -1, value = "", type = "string", args = arguments;
|
||||||
function next(check) {
|
function next(check) {
|
||||||
if (++index >= args.length) {return false}
|
if (++index >= args.length) {return false}
|
||||||
@ -16,10 +16,10 @@ function shy(help, meta, list, cb) { // 封装函数
|
|||||||
cb.runs = function() {};
|
cb.runs = function() {};
|
||||||
return cb;
|
return cb;
|
||||||
}
|
}
|
||||||
function Volcanos(name, can, libs, cb, msg) { // 封装模块
|
function Volcanos(name, can, libs, cb, msg) {
|
||||||
// 全局缓存
|
// 全局缓存
|
||||||
var list = arguments.callee.list || [], meta = arguments.callee.meta || {index: 1, cache: {}};
|
var list = arguments.callee.list || [], meta = arguments.callee.meta || {index: 1, cache: {}};
|
||||||
arguments.callee.meta = meta, arguments.callee.list = list;
|
arguments.callee.list = list, arguments.callee.meta = meta;
|
||||||
|
|
||||||
// 定义原型
|
// 定义原型
|
||||||
var id = 1, conf = {}, conf_cb = {}, sync = {}, cache = {};
|
var id = 1, conf = {}, conf_cb = {}, sync = {}, cache = {};
|
||||||
@ -79,7 +79,7 @@ function Volcanos(name, can, libs, cb, msg) { // 封装模块
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 加载脚本
|
// 加载脚本
|
||||||
can.Dream(libs[0].endsWith(".css")? document.head: document.body,
|
can.Dream(libs[0].endsWith(".css")? can.head||document.head: can.body||document.body,
|
||||||
!libs[0].endsWith("/") && libs[0].indexOf(".") == -1? libs[0]+".js": libs[0], function() {
|
!libs[0].endsWith("/") && libs[0].indexOf(".") == -1? libs[0]+".js": libs[0], function() {
|
||||||
can._load(libs[0]), can.require(libs.slice(1), cb);
|
can._load(libs[0]), can.require(libs.slice(1), cb);
|
||||||
})
|
})
|
||||||
@ -199,18 +199,18 @@ function Volcanos(name, can, libs, cb, msg) { // 封装模块
|
|||||||
};
|
};
|
||||||
return msg.event = event, msg
|
return msg.event = event, msg
|
||||||
}),
|
}),
|
||||||
Dream: shy("构造器", function(target, type, line) {
|
Dream: shy("构造器", function(target, type, line) {var p = window.Config && Config.volcano || "";
|
||||||
if (type.endsWith(".css")) {
|
if (type.endsWith(".css")) {
|
||||||
var style = document.createElement("link");
|
var style = document.createElement("link");
|
||||||
style.rel = "stylesheet", style.type = "text/css";
|
style.rel = "stylesheet", style.type = "text/css";
|
||||||
style.href = (type.startsWith("/")? "": Config.volcano)+type;
|
style.href = (type.startsWith("/")? "": p)+type;
|
||||||
style.onload = line;
|
style.onload = line;
|
||||||
target.appendChild(style);
|
target.appendChild(style);
|
||||||
return style
|
return style
|
||||||
}
|
}
|
||||||
if (type.endsWith(".js")) {
|
if (type.endsWith(".js")) {
|
||||||
var script = document.createElement("script");
|
var script = document.createElement("script");
|
||||||
script.src = (type.startsWith("/")? "": Config.volcano)+type;
|
script.src = (type.startsWith("/")? "": p)+type;
|
||||||
script.onload = line
|
script.onload = line
|
||||||
target.appendChild(script);
|
target.appendChild(script);
|
||||||
return script
|
return script
|
||||||
@ -264,6 +264,7 @@ function Volcanos(name, can, libs, cb, msg) { // 封装模块
|
|||||||
can.require(libs, function() {
|
can.require(libs, function() {
|
||||||
can.onimport && can.onimport._begin && can.onimport._begin(can)
|
can.onimport && can.onimport._begin && can.onimport._begin(can)
|
||||||
typeof cb == "function" && cb(can);
|
typeof cb == "function" && cb(can);
|
||||||
|
|
||||||
if (can.target) {
|
if (can.target) {
|
||||||
function run(event, msg, key, cb) {
|
function run(event, msg, key, cb) {
|
||||||
if (typeof cb == "function") {
|
if (typeof cb == "function") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user