generated from g3w-suite/g3w-client-plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.js
39 lines (35 loc) · 1.04 KB
/
service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const {base, inherit} = g3wsdk.core.utils;
const {PluginService} = g3wsdk.core.plugin;
const {GUI} = g3wsdk.gui;
function Service() {
base(this);
this.init = function(config={}) {
this.config = config;
/**
* Object where store key and setter name method to eventually remove when plugin is removed
* @type {{}}
*/
this.keySetters = {};
/**
* Get Query result service
*/
this.queryresultsService = GUI.getService('queryresults');
/**
* HERE CODE TO LISTEN AND REGISTER QUERY RESULTS SERVICE SETTERS CALL
*
* ES. setQueryResponse
*
* const keyOnAfterSetQueryResponse = this.queryresultsService.onafter('setQueryResponse', ()=>{CODE HERE})
* this.keySetters[keyOnAfterSetQueryResponse] = 'setQueryResponse'
*
*/
};
this.clear = function() {
/**
* Unlisten to setters call events
*/
Object.enties(this.keySetters).forEach(([key, setter]) => this.queryresultsService.un(setter, key));
}
}
inherit(Service, PluginService);
module.exports = new Service;