@evergis/api
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -11,2 +11,3 @@ import { DynamicLayer } from '@evergis/sgis/es/layers/DynamicLayer'; | ||
getUrl(bbox: Bbox, resolution: number): string; | ||
private subscribeRedraw; | ||
} | ||
@@ -13,0 +14,0 @@ export declare type EvergisDynamicLayerParams = { |
@@ -8,2 +8,3 @@ import { DynamicLayer } from '@evergis/sgis/es/layers/DynamicLayer'; | ||
this._style = configuration.style; | ||
this.subscribeRedraw(api); | ||
} | ||
@@ -28,3 +29,12 @@ set style(value) { | ||
} | ||
subscribeRedraw(api) { | ||
const tag = `service_update_${this.name.replace(/\//g, '_')}`; | ||
api.notification.subscribe(tag).then(() => { | ||
api.notification.on(tag, () => { | ||
this.forceUpdate(); | ||
this.redraw(); | ||
}); | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=EvergisDynamicLayer.js.map |
@@ -8,2 +8,3 @@ import { NotificationService } from '../__generated__/NotificationService'; | ||
private ws?; | ||
private wsUrl?; | ||
constructor(info: ServiceInfoDc, http: IHttpClient); | ||
@@ -15,2 +16,3 @@ on<Data, Result>(tag: string, handler: NotificationHandler<Data, Result>): void; | ||
connectWs(url: string, sessionId?: string): void; | ||
private connect; | ||
private onWsConnected; | ||
@@ -17,0 +19,0 @@ private onWsClosed; |
@@ -11,2 +11,3 @@ import { NotificationService } from '../__generated__/NotificationService'; | ||
console.log('WebSocket connection closed.'); | ||
this.connect(); | ||
}; | ||
@@ -47,8 +48,17 @@ this.onWsMessage = (event) => { | ||
connectWs(url, sessionId) { | ||
const wsUrl = url.replace('http://', 'ws://').replace('https://', 'wss://'); | ||
this.ws = new WebSocket(wsUrl + '?_sb=' + encodeURIComponent(sessionId || '')); | ||
this.ws.onopen = this.onWsConnected; | ||
this.ws.onclose = this.onWsClosed; | ||
this.ws.onmessage = this.onWsMessage; | ||
const urlWithWsScheme = url | ||
.replace('http://', 'ws://') | ||
.replace('https://', 'wss://'); | ||
this.wsUrl = | ||
urlWithWsScheme + '?_sb=' + encodeURIComponent(sessionId || ''); | ||
this.connect(); | ||
} | ||
connect() { | ||
if (this.wsUrl) { | ||
this.ws = new WebSocket(this.wsUrl); | ||
this.ws.onopen = this.onWsConnected; | ||
this.ws.onclose = this.onWsClosed; | ||
this.ws.onmessage = this.onWsMessage; | ||
} | ||
} | ||
} | ||
@@ -55,0 +65,0 @@ export class NotificationEvent { |
{ | ||
"name": "@evergis/api", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "author": "everpoint", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
210770
4501