Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "procedure", | ||
"description": "Simple JS async develpoment, easy error handling, chained results, declarative way.", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"author": { | ||
@@ -15,9 +15,9 @@ "name": "Javier Gallego Martín", | ||
], | ||
"homepage": "https://github.com/bifuer/procedure", | ||
"homepage": "https://github.com/pillarsjs/procedure", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/bifuer/procedure" | ||
"url": "git://github.com/pillarsjs/procedure" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/bifuer/procedure/issues", | ||
"url": "https://github.com/pillarsjs/procedure/issues", | ||
"email" : "cheloq@gmail.com" | ||
@@ -24,0 +24,0 @@ }, |
@@ -1,1 +0,42 @@ | ||
# Procedure | ||
# Procedure | ||
Simple JS async development. | ||
```javascript | ||
function fileLoader(path,done){ // File loader simulation. | ||
console.log("Opening file:'"+path+"'..."); | ||
if(path==='./secundary2.key'){ | ||
//throw new Error("Ops!"); // Error simulation | ||
} | ||
done.result({file:path}); // Finalize task & return result | ||
} | ||
var shared = {}; // Shared closure | ||
var procedure = new Procedure(); // Create procedure | ||
procedure | ||
.add("Load primary",fileLoader,'./primary.key') // Add new task | ||
.add("Load secundary",fileLoader,'./secundary.key') // Add new task | ||
.add("Load shared",fileLoader,'./shared.key') // Add new task | ||
.race() // Resolve tasks in race mode | ||
.add(function(files,done){ // Add new task | ||
shared.files1 = files; | ||
console.log(shared); | ||
done(); // Finalize task | ||
}) | ||
.queue() // Resolve tasks in queue mode | ||
.add("Load primary",fileLoader,'./primary2.key') // Add new task | ||
.add("Load secundary",fileLoader,'./secundary2.key') // Add new task | ||
.add("Load shared",fileLoader,'./shared2.key') // Add new task | ||
.race() // Resolve tasks in race mode | ||
.add(function(files,done){ // Add new task | ||
shared.files2 = files; | ||
console.log(shared); | ||
done.result(shared); // Finalize task & return result | ||
}) | ||
.launch(function(errors){ // Procedure controller. | ||
if(errors){ // Array of Errors || undefined | ||
console.log("END[ERROR]",arguments); | ||
} else { | ||
console.log("END[OK]",arguments); | ||
} | ||
}) | ||
; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9997
43