septima-widget 3.5.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/widgetapi.mjs +21 -6
package/package.json
CHANGED
package/widgetapi.mjs
CHANGED
|
@@ -2,10 +2,11 @@ export default class WidgetAPI {
|
|
|
2
2
|
_readylisteners = []
|
|
3
3
|
_controlsreadylisteners = []
|
|
4
4
|
_vectorreadylisteners = []
|
|
5
|
+
_eventListeners = []
|
|
5
6
|
|
|
6
7
|
_target = null
|
|
7
8
|
|
|
8
|
-
VERSION = '3.
|
|
9
|
+
VERSION = '3.6.0'
|
|
9
10
|
|
|
10
11
|
isReady = false
|
|
11
12
|
|
|
@@ -15,7 +16,7 @@ export default class WidgetAPI {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
async _load(target, config, options) {
|
|
18
|
-
const { load } = await import('https://widget.cdn.septima.dk/3.
|
|
19
|
+
const { load } = await import('https://widget.cdn.septima.dk/3.6.0/core/load.mjs')
|
|
19
20
|
this._widget = await load(target, config, options, this)
|
|
20
21
|
this.on('controlsready', () => {
|
|
21
22
|
this._controlsReady()
|
|
@@ -109,11 +110,25 @@ export default class WidgetAPI {
|
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
on(event,
|
|
113
|
+
on(event, listener) {
|
|
113
114
|
if (this._widget && typeof this._widget.events !== 'undefined') {
|
|
114
|
-
this._widget.events.on(event,
|
|
115
|
+
return this._widget.events.on(event, listener)
|
|
115
116
|
} else {
|
|
116
|
-
|
|
117
|
+
const id = this._eventListeners.length
|
|
118
|
+
this._eventListeners[id] = null
|
|
119
|
+
this._ready(() => this._eventListeners[id] = this._widget.events.on(event, listener))
|
|
120
|
+
return { id }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
off(listener) {
|
|
125
|
+
if (this._widget && typeof this._widget.events !== 'undefined') {
|
|
126
|
+
if (typeof listener.id !== 'undefined') {
|
|
127
|
+
listener = this._eventListeners[listener.id]
|
|
128
|
+
}
|
|
129
|
+
this._widget.events.off(listener)
|
|
130
|
+
} else {
|
|
131
|
+
this._ready(() => this.off(listener))
|
|
117
132
|
}
|
|
118
133
|
}
|
|
119
134
|
|
|
@@ -202,7 +217,7 @@ export default class WidgetAPI {
|
|
|
202
217
|
|
|
203
218
|
transform(geojson, options, callback) {
|
|
204
219
|
this._controlsReady(async () => {
|
|
205
|
-
const { transform } = await import('https://widget.cdn.septima.dk/3.
|
|
220
|
+
const { transform } = await import('https://widget.cdn.septima.dk/3.6.0/core/utils.mjs')
|
|
206
221
|
if (callback) {
|
|
207
222
|
callback(transform(geojson, options))
|
|
208
223
|
} else {
|