@google/earthengine 1.7.18 → 1.7.20
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/build/browser.js +192 -154
- package/build/ee_api_js.js +586 -583
- package/build/ee_api_js_debug.js +169 -131
- package/build/ee_api_js_npm.js +192 -154
- package/build/main.js +192 -154
- package/package.json +1 -1
- package/src/abstractoverlay.js +7 -7
- package/src/apiclient.js +11 -3
- package/src/apifunction.js +69 -9
- package/src/collection.js +23 -20
- package/src/computedobject.js +16 -12
- package/src/customfunction.js +17 -10
- package/src/date.js +8 -7
- package/src/deserializer.js +12 -2
- package/src/dictionary.js +6 -3
- package/src/ee.js +18 -16
- package/src/element.js +16 -13
- package/src/feature.js +10 -7
- package/src/floattileoverlay.js +15 -15
- package/src/list.js +4 -1
- package/src/maplayeroverlay.js +23 -23
- package/src/maptilemanager.js +39 -31
- package/src/number.js +4 -1
- package/src/profiler.js +4 -2
- package/src/string.js +10 -3
- package/src/types.js +5 -5
package/src/maptilemanager.js
CHANGED
|
@@ -56,14 +56,14 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* The pool of tokens.
|
|
59
|
-
* @type {ee.MapTileManager.TokenPool_}
|
|
59
|
+
* @type {?ee.MapTileManager.TokenPool_}
|
|
60
60
|
* @private
|
|
61
61
|
*/
|
|
62
62
|
this.tokenPool_ = new ee.MapTileManager.TokenPool_(0, 60);
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Map of IDs to requests.
|
|
66
|
-
* @type {goog.structs.Map}
|
|
66
|
+
* @type {?goog.structs.Map}
|
|
67
67
|
* @private
|
|
68
68
|
*/
|
|
69
69
|
this.requests_ = new goog.structs.Map();
|
|
@@ -99,7 +99,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
99
99
|
throw Error(ee.MapTileManager.ERROR_ID_IN_USE_);
|
|
100
100
|
}
|
|
101
101
|
// Make the Request object.
|
|
102
|
-
|
|
102
|
+
const request = new ee.MapTileManager.Request_(
|
|
103
103
|
id, url, opt_imageCompletedCallback,
|
|
104
104
|
goog.bind(this.releaseRequest_, this),
|
|
105
105
|
opt_maxRetries !== undefined ? opt_maxRetries :
|
|
@@ -107,7 +107,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
107
107
|
this.requests_.set(id, request);
|
|
108
108
|
|
|
109
109
|
// Setup the callback for the pool.
|
|
110
|
-
|
|
110
|
+
const callback = goog.bind(this.handleAvailableToken_, this, request);
|
|
111
111
|
this.tokenPool_.getObject(callback, opt_priority);
|
|
112
112
|
|
|
113
113
|
return request;
|
|
@@ -118,7 +118,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
118
118
|
* @param {string} id The id of the request to abort.
|
|
119
119
|
*/
|
|
120
120
|
abort(id) {
|
|
121
|
-
|
|
121
|
+
const request = /** @type {!ee.MapTileManager.Request_} */
|
|
122
122
|
(this.requests_.get(id));
|
|
123
123
|
if (request) {
|
|
124
124
|
request.setAborted(true);
|
|
@@ -129,9 +129,9 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
129
129
|
/**
|
|
130
130
|
* Handles a Token object that became available. Sets up the callback,
|
|
131
131
|
* and starts the process to send the request.
|
|
132
|
-
* @param {ee.MapTileManager.Request_} request A request to associate
|
|
132
|
+
* @param {!ee.MapTileManager.Request_} request A request to associate
|
|
133
133
|
* the token with.
|
|
134
|
-
* @param {ee.MapTileManager.Token_} token The available Token_ object.
|
|
134
|
+
* @param {!ee.MapTileManager.Token_} token The available Token_ object.
|
|
135
135
|
* @private
|
|
136
136
|
*/
|
|
137
137
|
handleAvailableToken_(request, token) {
|
|
@@ -156,7 +156,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
158
|
* Finishes processing of a request and releases its token if possible.
|
|
159
|
-
* @param {ee.MapTileManager.Request_} request The object to process.
|
|
159
|
+
* @param {!ee.MapTileManager.Request_} request The object to process.
|
|
160
160
|
* @private
|
|
161
161
|
*/
|
|
162
162
|
releaseRequest_(request) {
|
|
@@ -170,7 +170,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Returns the token back to the pool.
|
|
173
|
-
* @param {ee.MapTileManager.Token_} token The object to release.
|
|
173
|
+
* @param {?ee.MapTileManager.Token_} token The object to release.
|
|
174
174
|
* @private
|
|
175
175
|
*/
|
|
176
176
|
releaseObject_(token) {
|
|
@@ -188,7 +188,7 @@ ee.MapTileManager = class extends goog.events.EventTarget {
|
|
|
188
188
|
this.tokenPool_ = null;
|
|
189
189
|
|
|
190
190
|
// Call dispose on each request.
|
|
191
|
-
|
|
191
|
+
const requests = this.requests_;
|
|
192
192
|
goog.array.forEach([...requests.values()], function(value) {
|
|
193
193
|
value.dispose();
|
|
194
194
|
});
|
|
@@ -216,7 +216,7 @@ ee.MapTileManager.MAX_RETRIES = 1;
|
|
|
216
216
|
/**
|
|
217
217
|
* Error to throw when a send is attempted with an ID that the manager already
|
|
218
218
|
* has registered for another request.
|
|
219
|
-
* @
|
|
219
|
+
* @const {string}
|
|
220
220
|
* @private
|
|
221
221
|
*/
|
|
222
222
|
ee.MapTileManager.ERROR_ID_IN_USE_ = '[ee.MapTileManager] ID in use';
|
|
@@ -227,15 +227,16 @@ ee.MapTileManager.ERROR_ID_IN_USE_ = '[ee.MapTileManager] ID in use';
|
|
|
227
227
|
* An encapsulation of everything needed to make a Xhr request.
|
|
228
228
|
* NOTE: This is used internal to the MapTileManager.
|
|
229
229
|
* @private
|
|
230
|
+
* @const
|
|
230
231
|
* @unrestricted
|
|
231
232
|
*/
|
|
232
233
|
ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
233
234
|
/**
|
|
234
235
|
* @param {string} id Unique id for the request.
|
|
235
236
|
* @param {string} url Uri to make the request too.
|
|
236
|
-
* @param {Function=} opt_imageEventCallback Callback attached to the events
|
|
237
|
+
* @param {!Function=} opt_imageEventCallback Callback attached to the events
|
|
237
238
|
* of the ImageLoader object of the request.
|
|
238
|
-
* @param {Function=} opt_requestCompleteCallback Callback function for when
|
|
239
|
+
* @param {!Function=} opt_requestCompleteCallback Callback function for when
|
|
239
240
|
* request is complete. NOTE: Only 1 callback supported across all
|
|
240
241
|
* events.
|
|
241
242
|
* @param {number=} opt_maxRetries The maximum number of times the request
|
|
@@ -250,14 +251,14 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
250
251
|
|
|
251
252
|
/**
|
|
252
253
|
* Uri to make the request too.
|
|
253
|
-
* @
|
|
254
|
+
* @const {string}
|
|
254
255
|
* @private
|
|
255
256
|
*/
|
|
256
257
|
this.url_ = url;
|
|
257
258
|
|
|
258
259
|
/**
|
|
259
260
|
* The maximum number of times the request should be retried.
|
|
260
|
-
* @
|
|
261
|
+
* @const {number}
|
|
261
262
|
* @private
|
|
262
263
|
*/
|
|
263
264
|
this.maxRetries_ = (opt_maxRetries !== undefined) ?
|
|
@@ -266,14 +267,14 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
266
267
|
|
|
267
268
|
/**
|
|
268
269
|
* Callback attached to the events of the ImageLoader object.
|
|
269
|
-
* @type {Function|undefined}
|
|
270
|
+
* @type {?Function|undefined}
|
|
270
271
|
* @private
|
|
271
272
|
*/
|
|
272
273
|
this.imageEventCallback_ = opt_imageEventCallback;
|
|
273
274
|
|
|
274
275
|
/**
|
|
275
276
|
* Callback function called when request is complete.
|
|
276
|
-
* @type {Function|undefined}
|
|
277
|
+
* @type {?Function|undefined}
|
|
277
278
|
* @private
|
|
278
279
|
*/
|
|
279
280
|
this.requestCompleteCallback_ = opt_requestCompleteCallback;
|
|
@@ -281,7 +282,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
281
282
|
|
|
282
283
|
/**
|
|
283
284
|
* Returns the ImageLoader instance handling this request.
|
|
284
|
-
* @return {goog.net.ImageLoader} The ImageLoader instance
|
|
285
|
+
* @return {?goog.net.ImageLoader} The ImageLoader instance
|
|
285
286
|
* handling this request.
|
|
286
287
|
*/
|
|
287
288
|
getImageLoader() {
|
|
@@ -290,7 +291,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
290
291
|
|
|
291
292
|
/**
|
|
292
293
|
* Sets the ImageLoader instance handling this request.
|
|
293
|
-
* @param {goog.net.ImageLoader} imageLoader The ImageLoader
|
|
294
|
+
* @param {!goog.net.ImageLoader} imageLoader The ImageLoader
|
|
294
295
|
* instance handling this request.
|
|
295
296
|
*/
|
|
296
297
|
setImageLoader(imageLoader) {
|
|
@@ -299,7 +300,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
299
300
|
|
|
300
301
|
/**
|
|
301
302
|
* Returns the Token_ instance guarding this request.
|
|
302
|
-
* @return {ee.MapTileManager.Token_} The Token_ instance
|
|
303
|
+
* @return {?ee.MapTileManager.Token_} The Token_ instance
|
|
303
304
|
* guarding this request.
|
|
304
305
|
*/
|
|
305
306
|
getToken() {
|
|
@@ -308,7 +309,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
308
309
|
|
|
309
310
|
/**
|
|
310
311
|
* Sets the Token_ instance handling this request.
|
|
311
|
-
* @param {ee.MapTileManager.Token_} token The Token_ instance
|
|
312
|
+
* @param {?ee.MapTileManager.Token_} token The Token_ instance
|
|
312
313
|
* guarding this request.
|
|
313
314
|
*/
|
|
314
315
|
setToken(token) {
|
|
@@ -319,7 +320,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
319
320
|
* Adds an event handler listening for image loading events.
|
|
320
321
|
*/
|
|
321
322
|
addImageEventListener() {
|
|
322
|
-
|
|
323
|
+
const types = ee.MapTileManager.Request_.IMAGE_LOADER_EVENT_TYPES_;
|
|
323
324
|
goog.events.listenOnce(
|
|
324
325
|
this.imageLoader_, types, goog.bind(this.handleImageEvent_, this));
|
|
325
326
|
}
|
|
@@ -402,7 +403,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
402
403
|
|
|
403
404
|
/**
|
|
404
405
|
* Handles all events fired by the ImageLoader object for a given request.
|
|
405
|
-
* @param {goog.events.Event} e The event.
|
|
406
|
+
* @param {!goog.events.Event} e The event.
|
|
406
407
|
* @private
|
|
407
408
|
*/
|
|
408
409
|
handleImageEvent_(e) {
|
|
@@ -436,7 +437,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
436
437
|
|
|
437
438
|
/**
|
|
438
439
|
* Handles the success of a request. Dispatches the SUCCESS event.
|
|
439
|
-
* @param {goog.events.Event} e An event to handle.
|
|
440
|
+
* @param {!goog.events.Event} e An event to handle.
|
|
440
441
|
* @private
|
|
441
442
|
*/
|
|
442
443
|
handleSuccess_(e) {
|
|
@@ -447,7 +448,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
447
448
|
* Handles the error of a request. If the request has not reach its maximum
|
|
448
449
|
* number of retries, then it lets the request retry naturally (will let the
|
|
449
450
|
* request hit the READY state). Else, it dispatches the ERROR event.
|
|
450
|
-
* @param {goog.events.Event} e An event to handle.
|
|
451
|
+
* @param {!goog.events.Event} e An event to handle.
|
|
451
452
|
* @private
|
|
452
453
|
*/
|
|
453
454
|
handleError_(e) {
|
|
@@ -491,7 +492,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
491
492
|
return;
|
|
492
493
|
}
|
|
493
494
|
|
|
494
|
-
|
|
495
|
+
const actuallyLoadImage = goog.bind(function(imageUrl) {
|
|
495
496
|
if (this.getAborted()) {
|
|
496
497
|
return;
|
|
497
498
|
}
|
|
@@ -500,7 +501,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
500
501
|
this.imageLoader_.start();
|
|
501
502
|
}, this);
|
|
502
503
|
|
|
503
|
-
|
|
504
|
+
const sourceUrl = this.getUrl();
|
|
504
505
|
// Parsing the URL here isn't all that great. It's just a way to not have to
|
|
505
506
|
// pass another parameter from MapLayerOverlay to here containing the same
|
|
506
507
|
// information.
|
|
@@ -509,7 +510,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
509
510
|
// response headers. Then construct an object URL for the response
|
|
510
511
|
// (possible because we specified 'blob' response type) so that we can
|
|
511
512
|
// load it as an image for the actual map tile display.
|
|
512
|
-
|
|
513
|
+
const xhrIo = new goog.net.XhrIo();
|
|
513
514
|
xhrIo.setResponseType(goog.net.XhrIo.ResponseType.BLOB);
|
|
514
515
|
xhrIo.listen(goog.net.EventType.COMPLETE, goog.bind(function(event) {
|
|
515
516
|
this.profileId_ =
|
|
@@ -518,7 +519,7 @@ ee.MapTileManager.Request_ = class extends goog.Disposable {
|
|
|
518
519
|
// Store the response, but only if it is not an error, because if we did
|
|
519
520
|
// then we would attempt to interpret the error response as an image.
|
|
520
521
|
// This also ensures that the Code Editor can display the error message.
|
|
521
|
-
|
|
522
|
+
let objectUrl, ok;
|
|
522
523
|
if (xhrIo.getStatus() >= 200 && xhrIo.getStatus() < 300) {
|
|
523
524
|
try {
|
|
524
525
|
objectUrl =
|
|
@@ -608,8 +609,9 @@ ee.MapTileManager.Request_.prototype.profileId_ = null;
|
|
|
608
609
|
|
|
609
610
|
/**
|
|
610
611
|
* The goog.net.EventType's to listen/unlisten for on the ImageLoader object.
|
|
611
|
-
* @type {Array
|
|
612
|
+
* @type {!Array.<!goog.net.EventType>}
|
|
612
613
|
* @private
|
|
614
|
+
* @const
|
|
613
615
|
*/
|
|
614
616
|
ee.MapTileManager.Request_.IMAGE_LOADER_EVENT_TYPES_ = [
|
|
615
617
|
goog.events.EventType.LOAD, goog.net.EventType.ABORT, goog.net.EventType.ERROR
|
|
@@ -620,6 +622,7 @@ ee.MapTileManager.Request_.IMAGE_LOADER_EVENT_TYPES_ = [
|
|
|
620
622
|
/**
|
|
621
623
|
* An object that we put into a PriorityPool to throttle requests.
|
|
622
624
|
* @private
|
|
625
|
+
* @const
|
|
623
626
|
* @unrestricted
|
|
624
627
|
*/
|
|
625
628
|
ee.MapTileManager.Token_ = class extends goog.Disposable {
|
|
@@ -656,6 +659,7 @@ ee.MapTileManager.Token_ = class extends goog.Disposable {
|
|
|
656
659
|
/**
|
|
657
660
|
* A pool of Token objects.
|
|
658
661
|
* @private
|
|
662
|
+
* @const
|
|
659
663
|
* @unrestricted
|
|
660
664
|
*/
|
|
661
665
|
ee.MapTileManager.TokenPool_ = class extends goog.structs.PriorityPool {
|
|
@@ -686,7 +690,11 @@ ee.MapTileManager.TokenPool_ = class extends goog.structs.PriorityPool {
|
|
|
686
690
|
obj.dispose();
|
|
687
691
|
}
|
|
688
692
|
|
|
689
|
-
/**
|
|
693
|
+
/**
|
|
694
|
+
* @param {!ee.MapTileManager.Token_} obj The object to check.
|
|
695
|
+
* @return {boolean} Whether the object can be reused.
|
|
696
|
+
* @override
|
|
697
|
+
*/
|
|
690
698
|
objectCanBeReused(obj) {
|
|
691
699
|
// An active ImageLoader object should never be used.
|
|
692
700
|
return !obj.isDisposed() && !obj.isActive();
|
package/src/number.js
CHANGED
|
@@ -78,12 +78,14 @@ ee.Number.reset = function() {
|
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* @override
|
|
81
|
+
* @param {function(*): *} encoder A function that encodes an object.
|
|
82
|
+
* @return {number|!Object}
|
|
81
83
|
*/
|
|
82
84
|
ee.Number.prototype.encode = function(encoder) {
|
|
83
85
|
if (typeof this.number_ === 'number') {
|
|
84
86
|
return this.number_;
|
|
85
87
|
} else {
|
|
86
|
-
return ee.Number.base(this, 'encode', encoder);
|
|
88
|
+
return /** @type {!Object} */ (ee.Number.base(this, 'encode', encoder));
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
91
|
|
|
@@ -101,6 +103,7 @@ ee.Number.prototype.encodeCloudValue = function(
|
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* @override
|
|
106
|
+
* @return {string}
|
|
104
107
|
*/
|
|
105
108
|
ee.Number.prototype.name = function() {
|
|
106
109
|
return 'Number';
|
package/src/profiler.js
CHANGED
|
@@ -84,7 +84,7 @@ ee.data.Profiler = class extends goog.events.EventTarget {
|
|
|
84
84
|
/**
|
|
85
85
|
* Helper to ensure we don't make too many profile requests.
|
|
86
86
|
* See DELAY_BEFORE_REFRESH_ for rationale.
|
|
87
|
-
* @private {!goog.async.Delay}
|
|
87
|
+
* @private @const {!goog.async.Delay}
|
|
88
88
|
*/
|
|
89
89
|
this.throttledRefresh_ = new goog.async.Delay(
|
|
90
90
|
goog.bind(this.refresh_, this), ee.data.Profiler.DELAY_BEFORE_REFRESH_);
|
|
@@ -336,6 +336,7 @@ ee.data.Profiler = class extends goog.events.EventTarget {
|
|
|
336
336
|
|
|
337
337
|
/**
|
|
338
338
|
* This class does not allow setting a parent event target.
|
|
339
|
+
* @param {?goog.events.EventTarget} parent
|
|
339
340
|
* @override
|
|
340
341
|
*/
|
|
341
342
|
setParentEventTarget(parent) {
|
|
@@ -375,7 +376,7 @@ ee.data.Profiler.DELAY_BEFORE_REFRESH_ = 500;
|
|
|
375
376
|
|
|
376
377
|
|
|
377
378
|
/**
|
|
378
|
-
* @private {!google.visualization.DataObject}
|
|
379
|
+
* @private @const {!google.visualization.DataObject}
|
|
379
380
|
*/
|
|
380
381
|
ee.data.Profiler.EMPTY_JSON_PROFILE_ = {
|
|
381
382
|
cols: [],
|
|
@@ -408,6 +409,7 @@ ee.data.Profiler.Format = class {
|
|
|
408
409
|
}
|
|
409
410
|
|
|
410
411
|
/**
|
|
412
|
+
* @return {string}
|
|
411
413
|
* @override
|
|
412
414
|
*/
|
|
413
415
|
toString() {
|
package/src/string.js
CHANGED
|
@@ -81,12 +81,16 @@ ee.String.reset = function() {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* @param {function(*): *} encoder
|
|
86
|
+
* @return {string|!Object}
|
|
87
|
+
* @override
|
|
88
|
+
*/
|
|
85
89
|
ee.String.prototype.encode = function(encoder) {
|
|
86
90
|
if (typeof (this.string_) === 'string') {
|
|
87
91
|
return this.string_;
|
|
88
92
|
} else {
|
|
89
|
-
return ee.String.base(this, 'encode', encoder);
|
|
93
|
+
return /** @type {!Object} */ (ee.String.base(this, 'encode', encoder));
|
|
90
94
|
}
|
|
91
95
|
};
|
|
92
96
|
|
|
@@ -102,7 +106,10 @@ ee.String.prototype.encodeCloudValue = function(
|
|
|
102
106
|
};
|
|
103
107
|
|
|
104
108
|
|
|
105
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* @return {string}
|
|
111
|
+
* @override
|
|
112
|
+
*/
|
|
106
113
|
ee.String.prototype.name = function() {
|
|
107
114
|
return 'String';
|
|
108
115
|
};
|
package/src/types.js
CHANGED
|
@@ -14,7 +14,7 @@ goog.requireType('ee.Function');
|
|
|
14
14
|
* Not technically needed in the JavaScript library, but it matches what
|
|
15
15
|
* we have to do in the Python library.
|
|
16
16
|
* The keys are the names of the ee classes. The values the class objects.
|
|
17
|
-
* @type {Object}
|
|
17
|
+
* @type {!Object}
|
|
18
18
|
* @private
|
|
19
19
|
*/
|
|
20
20
|
ee.Types.registeredClasses_ = {};
|
|
@@ -22,7 +22,7 @@ ee.Types.registeredClasses_ = {};
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Register the classes available in the ee object for lookup.
|
|
25
|
-
* @param {Object} classes The classes available in the ee object for lookup.
|
|
25
|
+
* @param {!Object} classes The classes available in the ee object for lookup.
|
|
26
26
|
*/
|
|
27
27
|
ee.Types.registerClasses = function(classes) {
|
|
28
28
|
ee.Types.registeredClasses_ = classes;
|
|
@@ -33,7 +33,7 @@ ee.Types.registerClasses = function(classes) {
|
|
|
33
33
|
* Converts a type name to a class constructor.
|
|
34
34
|
*
|
|
35
35
|
* @param {string} name The class name.
|
|
36
|
-
* @return {Function} The constructor for the named class or null if it's not an
|
|
36
|
+
* @return {?Function} The constructor for the named class or null if it's not an
|
|
37
37
|
* ee class.
|
|
38
38
|
*/
|
|
39
39
|
ee.Types.nameToClass = function(name) {
|
|
@@ -47,7 +47,7 @@ ee.Types.nameToClass = function(name) {
|
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* Converts a class constructor to the API-friendly type name.
|
|
50
|
-
* @param {Function} klass The class constructor.
|
|
50
|
+
* @param {!Function} klass The class constructor.
|
|
51
51
|
* @return {string} The name of the class, or "Object" if not recognized.
|
|
52
52
|
*/
|
|
53
53
|
ee.Types.classToName = function(klass) {
|
|
@@ -144,7 +144,7 @@ ee.Types.isArray = function(obj) {
|
|
|
144
144
|
*/
|
|
145
145
|
ee.Types.isRegularObject = function(obj) {
|
|
146
146
|
if (goog.isObject(obj) && typeof obj !== 'function') {
|
|
147
|
-
|
|
147
|
+
const proto = Object.getPrototypeOf(obj);
|
|
148
148
|
return proto !== null && Object.getPrototypeOf(proto) === null;
|
|
149
149
|
} else {
|
|
150
150
|
return false;
|