Skip to content

Commit

Permalink
improved extension example
Browse files Browse the repository at this point in the history
  • Loading branch information
RIAEvangelist committed Dec 4, 2015
1 parent 03f8b5d commit de1d680
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,19 @@ This allows you to start adding requests immediately and only execute if the web
//merge this and Queue inorder to extend
Object.assign(this,new Queue);

//extend
//extend with some stuff your app needs, maybe npm publish your extention with js-queue as a dependancy?
Object.defineProperties(
this,
{
isStopped:{
enumerable:true,
get:checkStopped,
set:checkStopped
},
removeThirdItem:{
enumerable:true,
writable:false,
value:removeThird
}
}
);
Expand All @@ -198,6 +203,17 @@ This allows you to start adding requests immediately and only execute if the web
function checkStopped(){
return this.stop;
}

function removeThird(){
//get the queue content
var list=this.contents;
//modify the queue content
list.splice(2,1);
//save the modified queue content
this.contents=list;

return this.contents;
}
}

```

0 comments on commit de1d680

Please sign in to comment.