First Commit of new way of building the Platform

This commit is contained in:
Luis Fernando Molina committed 2020-01-28 17:27:23 +01:00
1 parent e48cf0dae5
commit 40e60b42cc
4616 files changed
+713402

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
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)();
}
}
+18
View File
@@ -0,0 +1,18 @@
var Stack=require('../stack');
//create a new Stack instance
var stack=new Stack;
stack.autoRun=false;
for(var i=0; i<50; i++){
//add a bunch of stuff to the stack
stack.add(makeRequest.bind(stack,i));
}
stack.next();
function makeRequest(index){
//do stuff
console.log(`making LIFO request ${index}`);
this.next();
}
+62
View File
@@ -0,0 +1,62 @@
{
"_args": [
[
"easy-stack@1.0.0",
"C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer"
]
],
"_from": "easy-stack@1.0.0",
"_id": "easy-stack@1.0.0",
"_inBundle": false,
"_integrity": "sha1-EskbMIWjfwuqM26UhurEv5Tj54g=",
"_location": "/easy-stack",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "easy-stack@1.0.0",
"name": "easy-stack",
"escapedName": "easy-stack",
"rawSpec": "1.0.0",
"saveSpec": null,
"fetchSpec": "1.0.0"
},
"_requiredBy": [
"/js-queue"
],
"_resolved": "https://registry.npmjs.org/easy-stack/-/easy-stack-1.0.0.tgz",
"_spec": "1.0.0",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\TaskServer",
"author": {
"name": "Brandon Nozaki Miller"
},
"bugs": {
"url": "https://github.com/RIAEvangelist/easy-stack/issues"
},
"description": "Simple JS stack with auto run for node and browsers",
"engines": {
"node": ">=6.0.0"
},
"homepage": "https://github.com/RIAEvangelist/easy-stack#readme",
"keywords": [
"stack",
"node",
"js",
"auto",
"run",
"execute",
"browser",
"react"
],
"license": "DBAD",
"main": "stack.js",
"name": "easy-stack",
"repository": {
"type": "git",
"url": "git+https://github.com/RIAEvangelist/easy-stack.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.0"
}
+39
View File
@@ -0,0 +1,39 @@
class Stack{
constructor(){
this.stack=[];
this.autoRun=true;
this.running=false;
this.stop=false;
}
clear(){
this.stack=[];
return this.stack;
}
contents(val){
if(val){
this.stack=val;
}
return this.stack;
}
add(...callbacks){
this.stack.push(...callbacks);
if(!this.running && !this.stop && this.autoRun){
this.next();
}
}
next(){
this.running=true;
if(this.stack.length<1 || this.stop){
this.running=false;
return;
}
this.stack.pop().bind(this)();
}
}
module.exports=Stack;