From de1d680a57df2aa794816053df15fab275570892 Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Fri, 4 Dec 2015 11:53:57 -0800 Subject: [PATCH] improved extension example --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ef4681..1c8934b 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ 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, { @@ -187,6 +187,11 @@ This allows you to start adding requests immediately and only execute if the web enumerable:true, get:checkStopped, set:checkStopped + }, + removeThirdItem:{ + enumerable:true, + writable:false, + value:removeThird } } ); @@ -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; + } } ```