Skip to content

Commit

Permalink
这里只放源码,文档请到http://rubylouvre.github.com/doc/index.html上看
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Aug 18, 2012
1 parent 7421fe7 commit 796da49
Show file tree
Hide file tree
Showing 804 changed files with 1,014 additions and 217,961 deletions.
Binary file removed AspNet.exe
Binary file not shown.
20 changes: 20 additions & 0 deletions MIT-LICENSE.txt
@@ -0,0 +1,20 @@
Copyright 2012 RubyLouvre http://www.cnblogs.com/rubylouvre/

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file removed Sws 2.3.exe
Binary file not shown.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion bin/AspNet.ini

This file was deleted.

2 changes: 1 addition & 1 deletion src/class.js → class.js
Expand Up @@ -2,7 +2,7 @@
// 类工厂模块
//==========================================
$.define("class", "lang",function(){
$.log("已加载类工厂模块")
//$.log("已加载类工厂模块")
var
unextend = $.oneObject(["_super","prototype", 'extend', 'implement' ]),
rconst = /constructor|_init|_super/,
Expand Down
2 changes: 1 addition & 1 deletion src/css.js → css.js
Expand Up @@ -524,7 +524,7 @@ $.define( "css", !!top.getComputedStyle ? "node" : "node,css_fix" , function(){
}
return val
};
var method = "scroll" + name;//scrollTop,scrollLeft只有读方法
var method = "scroll" + name;
$.fn[ method ] = function( val ) {
var node, win, t = name == "Top";
if ( val === void 0 ) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
109 changes: 104 additions & 5 deletions src/flow.js → flow.js
@@ -1,11 +1,25 @@
//=========================================
// 操作流模块,用于流程控制
// 操作流模块v2,用于流程控制
//==========================================
$.define("flow","class",function(){//~表示省略,说明lang模块与flow模块在同一目录
var uuid_arr = '0123456789ABCDEFG'.split('');
return $.Flow = $.factory({
init: function(){
this.root = {};//数据共享,但策略自定
this.uuid = $.getUid({})
this.id = this.id || this.uuid()
},
//https://github.com/louisremi/Math.uuid.js/blob/master/Math.uuid.js
uuid: function(){
var uuid = [], r, i = 36;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
while (i--) {
if (!uuid[i]) {
r = Math.random()*16|0;
uuid[i] = uuid_arr[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
return uuid.join('');
},
/**
names 可以为数组,用逗号作为分隔符的字符串,callback是回调函数,reload,布尔,可选,决定最后回调的第二次触发的条件
Expand All @@ -20,7 +34,7 @@ $.define("flow","class",function(){//~表示省略,说明lang模块与flow模
然后我再调用flow.fire("aaa"),fn就会被第二次触发;反正我们无论是fire上述那个操作,bbb也好,ccc也好,fn都会立即执行,
不用着等到四个都触发才执行!只有当reload设置为true时,我们才需要每次把这个步骤都执行了一遍才触发fn。*/
bind: function(names,callback,reload){
var root = this.root, deps = {},args = []
var root = this.root, deps = {},args = []
String(names +"").replace($.rword,function(name){
name = "__"+name;//处理toString与valueOf等属性
if(!root[name]){
Expand All @@ -42,6 +56,88 @@ $.define("flow","class",function(){//~表示省略,说明lang模块与flow模
callback.reload = !!reload;//默认每次重新加载
return this;
},
//用于取回符合条件的回调 opts = {match:正则,names:字符串,fired: 布尔}
find: function(names,opts){
names = names || {}
if(typeof names == "string"){
opts = opts || {}
opts.names = names;
}else{
opts = names;
}
names = opts.names;
var fired = !!opts.fired;//是否包含已经fire过的回调
var root = this.root, callbacks = [], sorted = [], uniq = {}
if(!names){//取得所有回调并去重
for(var i in root){
callbacks = callbacks.concat(root[i].unfire);
if(fired){
callbacks = callbacks.concat(root[i].fired);
}
}
callbacks = $.Array.unique(callbacks);
}else{
String(names +"").replace($.rword,function(name){
name = "__"+name;//处理toString与valueOf等属性
callbacks = callbacks.concat(root[name].unfire);
if(!uniq[name]){//去重
sorted.push(name);
uniq[name] = 1;
}
if(fired){
callbacks = callbacks.concat(root[name].fired);
}
});
callbacks = $.Array.unique(callbacks);
sorted = String(sorted.sort());
callbacks = callbacks.filter(function(fn){
return String(fn.args.sort()).indexOf(sorted) > -1
})
}
if( $.type( opts.match,"RegExp" ) ){
var reg = opts.match;
callbacks = callbacks.filter(function(fn){
for(var i = 0, n = fn.args.length; i < n ;i++){
var name = fn.args[i].slice(2);
if( reg.test( name ) ){
return true;
}
}
return false
})
}
return callbacks;
},
append: function( names, name ){
var callback = this.find( names );
var root = this.root
name = "__"+name;
callback.forEach(function(fn){
if(!(name in fn.deps)){
fn.deps[name] = 1;
fn.args.push(name);
if(!root[name]){
root[name] = {
unfire : [fn],//正在等待解发的回调
fired: [],//已经触发的回调
state : 0
}
}else {
root[name].unfire.unshift(fn)
}
}
});
return this;
},
reduce: function(names,name){
var callback = this.find(names)
var released = "__"+name
callback.forEach(function(fn){
delete fn.deps[released];
$.Array.remove(fn.args, released)
});
return this;
},
/**
移除某个操作的回调(1)或所有回调(2),或同时移除多个操作(3)
(1)$.unbind("aaa")
Expand Down Expand Up @@ -98,7 +194,7 @@ $.define("flow","class",function(){//~表示省略,说明lang模块与flow模
try{
this.fire.apply(this, arguments);
}catch(e){
this.fire( "__error__", e);//如果发生异常,抛出500错误
this.fire( "error_" + this.id, e);//如果发生异常,抛出500错误
}
}else{//执行fired数组中的回调
for (i = fired.length; fn = fired[--i]; ) {
Expand All @@ -124,6 +220,8 @@ $.define("flow","class",function(){//~表示省略,说明lang模块与flow模
/**
2012.6.8 对fire的传参进行处理
2012.7.13 使用新式的相对路径依赖模块
2012.8.14 添加find append reduce三个方法,随意增删某一个步骤
2012.8.17 添加uuid方法
一个简单的例子
$.require("flow", function(){
var node = new $.Flow();
Expand All @@ -135,4 +233,5 @@ $.define("flow","class",function(){//~表示省略,说明lang模块与flow模
});
node.fire("aaa")
})
*/
*/

0 comments on commit 796da49

Please sign in to comment.