File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ const StoreIPAddress = require('@ladjs/store-ip-address');
1010const Timeout = require ( 'koa-better-timeout' ) ;
1111const _ = require ( 'lodash' ) ;
1212const auth = require ( 'koa-basic-auth' ) ;
13- const autoBind = require ( 'auto-bind' ) ;
1413const bodyParser = require ( 'koa-bodyparser' ) ;
1514const boolean = require ( 'boolean' ) ;
1615const compress = require ( 'koa-compress' ) ;
@@ -168,17 +167,17 @@ class API {
168167 this . server = server ;
169168 this . client = client ;
170169
171- autoBind ( this ) ;
170+ // bind listen/close to this
171+ this . listen = this . listen . bind ( this ) ;
172+ this . close = this . close . bind ( this ) ;
172173 }
173174
174175 async listen ( port ) {
175- const { server } = this ;
176- this . server = await util . promisify ( server . listen ) . bind ( server ) ( port ) ;
176+ await util . promisify ( this . server . listen ) . bind ( this . server ) ( port ) ;
177177 }
178178
179179 async close ( ) {
180- const { server } = this ;
181- this . server = await util . promisify ( server . close ) . bind ( server ) ;
180+ await util . promisify ( this . server . close ) . bind ( this . server ) ;
182181 }
183182}
184183
Original file line number Diff line number Diff line change 5050 "devDependencies" : {
5151 "@commitlint/cli" : " ^8.1.0" ,
5252 "@commitlint/config-conventional" : " ^8.1.0" ,
53- "auto-bind" : " ^2.1.0" ,
5453 "ava" : " ^2.3.0" ,
5554 "codecov" : " ^3.5.0" ,
5655 "cross-env" : " ^5.2.1" ,
You can’t perform that action at this time.
0 commit comments