forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServiceBase.js
More file actions
44 lines (37 loc) · 1.23 KB
/
Copy pathServiceBase.js
File metadata and controls
44 lines (37 loc) · 1.23 KB
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
40
41
42
43
44
import L from "leaflet";
/**
* @class L.supermap.ServiceBase
* @classdesc L.supermap 服务基类。
* @category iServer
* @param {string} url - 与客户端交互的服务地址。
* @param {Object} options - 参数。
* @param {string} [options.proxy] - 服务代理地址。
* @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 iServer|iPortal|online。
* @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
*/
export var ServiceBase = L.Evented.extend({
options: {
url: null,
proxy: null,
//服务来源 iServer|iPortal|online
serverType: null,
withCredentials: false
},
initialize: function (url, options) {
if (url) {
url = (url.indexOf("/") !== url.length - 1) ?
url : url.substr(0, url.length - 1);
}
this.url = url;
L.setOptions(this, options);
this.fire("initialized", this);
},
/**
* @function L.supermap.ServiceBase.prototype.destroy
* @description 释放资源,将引用的资源属性置空。
*/
destroy: function () {
this.fire("destroy", this);
}
});
L.supermap.ServiceBase = ServiceBase;