@tiermobility/tile38-ts
Advanced tools
Comparing version 2.0.0-beta.5 to 2.0.0-beta.6
@@ -9,2 +9,3 @@ "use strict"; | ||
const ioredis_1 = require("ioredis"); | ||
const events_2 = require("./events"); | ||
const parseResponse_1 = require("./parseResponse"); | ||
@@ -117,15 +118,11 @@ var Command; | ||
}) | ||
.on('error', (error) => { | ||
/* istanbul ignore next */ | ||
this.emit('error', error); | ||
}) | ||
.on('end', () => { | ||
this.format = Format.RESP; | ||
}); | ||
(0, events_2.forwardEvents)(this.redis, this); | ||
this.subscriber = this.redis | ||
.duplicate() | ||
.on('error', (error) => { | ||
/* istanbul ignore next */ | ||
this.emit('error', error); | ||
}) | ||
.on('error', (error) => | ||
/* istanbul ignore next */ | ||
this.emit('error', error)) | ||
.on('message', (channel, message) => this.emit('message', JSON.parse(message), channel)) | ||
@@ -132,0 +129,0 @@ .on('pmessage', (pattern, channel, message) => this.emit('message', JSON.parse(message), channel, pattern)); |
@@ -10,9 +10,8 @@ "use strict"; | ||
const commands_1 = require("./commands"); | ||
const events_2 = require("./events"); | ||
class Follower extends events_1.default { | ||
constructor(...args) { | ||
super(); | ||
this.client = new Client_1.Client(...args).on('error', (error) => { | ||
/* istanbul ignore next */ | ||
this.emit('error', error); | ||
}); | ||
this.client = new Client_1.Client(...args); | ||
(0, events_2.forwardEvents)(this.client, this); | ||
} | ||
@@ -19,0 +18,0 @@ bounds(key) { |
@@ -197,3 +197,9 @@ import { GeoJSON } from '@vpriem/geojson'; | ||
interface Tile38BaseInterface { | ||
on(event: 'connect', listener: () => void): this; | ||
on(event: 'ready', listener: () => void): this; | ||
on(event: 'error', listener: (error: Error) => void): this; | ||
on(event: 'close', listener: () => void): this; | ||
on(event: 'reconnecting', listener: () => void): this; | ||
on(event: 'end', listener: () => void): this; | ||
on(event: 'wait', listener: () => void): this; | ||
bounds(key: string): Promise<BoundsResponse>; | ||
@@ -200,0 +206,0 @@ chans(pattern?: string): Promise<ChansResponse>; |
@@ -11,6 +11,7 @@ "use strict"; | ||
if (typeof args[0] === 'string' && typeof args[1] === 'string') { | ||
this._follower = new Follower_1.Follower(args[1], args[2]).on('error', (error) => { | ||
/* istanbul ignore next */ | ||
this.emit('error', error); | ||
}); | ||
this._follower = new Follower_1.Follower(args[1], args[2]) | ||
// forwarding follower errors | ||
.on('error', (error) => | ||
/* istanbul ignore next */ | ||
this.emit('error', error)); | ||
} | ||
@@ -17,0 +18,0 @@ } |
{ | ||
"name": "@tiermobility/tile38-ts", | ||
"version": "2.0.0-beta.5", | ||
"version": "2.0.0-beta.6", | ||
"description": "A Node.js Tile38 client written in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -115,6 +115,16 @@ <br /> | ||
}, | ||
}, | ||
} | ||
); | ||
``` | ||
### Events | ||
We expose `ioredis` [Events](https://github.com/redis/ioredis#events). | ||
```typescript | ||
new Tile38() | ||
.on('connect', () => console.log('connected')) | ||
.on('error', console.error); | ||
``` | ||
### Pagination | ||
@@ -121,0 +131,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
198401
107
2319
848