1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
es5.js 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-17 14:52 +08:00 . Vueinit
function Stack(){
Object.defineProperties(
this,
{
add:{
enumerable:true,
writable:false,
value:addToStack
},
next:{
enumerable:true,
writable:false,
value:run
},
clear:{
enumerable:true,
writable:false,
value:clearStack
},
contents:{
enumerable:false,
get:getStack,
set:setStack
},
autoRun:{
enumerable:true,
writable:true,
value:true
},
stop:{
enumerable:true,
writable:true,
value:false
}
}
);
var stack=[];
var running=false;
var stop=false;
function clearStack(){
stack=[];
return stack;
}
function getStack(){
return stack;
}
function setStack(val){
stack=val;
return stack;
}
function addToStack(){
for(var i in arguments){
stack.unshift(arguments[i]);
}
if(!running && !this.stop && this.autoRun){
this.next();
}
}
function run(){
running=true;
if(stack.length<1 || this.stop){
running=false;
return;
}
stack.shift().bind(this)();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助