Use || operator instead of goog.isDef()/?:
This commit is contained in:
@@ -23,14 +23,13 @@ ol.Attribution = function(html, opt_coverageAreas, opt_projection) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {Array.<ol.CoverageArea>}
|
* @type {Array.<ol.CoverageArea>}
|
||||||
*/
|
*/
|
||||||
this.coverageAreas_ =
|
this.coverageAreas_ = opt_coverageAreas || null;
|
||||||
goog.isDef(opt_coverageAreas) ? opt_coverageAreas : null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Projection}
|
* @type {ol.Projection}
|
||||||
*/
|
*/
|
||||||
this.projection_ = goog.isDef(opt_projection) ? opt_projection : null;
|
this.projection_ = opt_projection || null;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ ol.Collection = function(opt_array) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {Array}
|
* @type {Array}
|
||||||
*/
|
*/
|
||||||
this.array_ = goog.isDefAndNotNull(opt_array) ? opt_array : [];
|
this.array_ = opt_array || [];
|
||||||
|
|
||||||
this.updateLength_();
|
this.updateLength_();
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ ol.Color = function(r, g, b, a) {
|
|||||||
*/
|
*/
|
||||||
ol.Color.createFromString = function(str, opt_a) {
|
ol.Color.createFromString = function(str, opt_a) {
|
||||||
var rgb = goog.color.hexToRgb(goog.color.parse(str).hex);
|
var rgb = goog.color.hexToRgb(goog.color.parse(str).hex);
|
||||||
var a = goog.isDef(opt_a) ? opt_a : 255;
|
var a = opt_a || 255;
|
||||||
return new ol.Color(rgb[0], rgb[1], rgb[2], a);
|
return new ol.Color(rgb[0], rgb[1], rgb[2], a);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -189,8 +189,8 @@ ol.Map = function(target, opt_values, opt_viewportSizeMonitor) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {goog.dom.ViewportSizeMonitor}
|
* @type {goog.dom.ViewportSizeMonitor}
|
||||||
*/
|
*/
|
||||||
this.viewportSizeMonitor_ = goog.isDef(opt_viewportSizeMonitor) ?
|
this.viewportSizeMonitor_ =
|
||||||
opt_viewportSizeMonitor : new goog.dom.ViewportSizeMonitor();
|
opt_viewportSizeMonitor || new goog.dom.ViewportSizeMonitor();
|
||||||
|
|
||||||
goog.events.listen(this.viewportSizeMonitor_, goog.events.EventType.RESIZE,
|
goog.events.listen(this.viewportSizeMonitor_, goog.events.EventType.RESIZE,
|
||||||
this.handleViewportResize, false, this);
|
this.handleViewportResize, false, this);
|
||||||
@@ -580,7 +580,7 @@ ol.Map.prototype.handleBackgroundColorChanged = goog.nullFunction;
|
|||||||
* @param {string=} opt_type Type.
|
* @param {string=} opt_type Type.
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
|
ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
|
||||||
var type = goog.isDef(opt_type) ? opt_type : browserEvent.type;
|
var type = opt_type || browserEvent.type;
|
||||||
var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent);
|
var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent);
|
||||||
var controls = this.getControls();
|
var controls = this.getControls();
|
||||||
var controlsArray = /** @type {Array.<ol.Control>} */ controls.getArray();
|
var controlsArray = /** @type {Array.<ol.Control>} */ controls.getArray();
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ ol.Object.getListeners = function(obj) {
|
|||||||
*/
|
*/
|
||||||
ol.Object.prototype.bindTo =
|
ol.Object.prototype.bindTo =
|
||||||
function(key, target, opt_targetKey, opt_noNotify) {
|
function(key, target, opt_targetKey, opt_noNotify) {
|
||||||
var targetKey = goog.isDef(opt_targetKey) ? opt_targetKey : key;
|
var targetKey = opt_targetKey || key;
|
||||||
this.unbind(key);
|
this.unbind(key);
|
||||||
var eventType = ol.Object.getChangedEventType(targetKey);
|
var eventType = ol.Object.getChangedEventType(targetKey);
|
||||||
var listeners = ol.Object.getListeners(this);
|
var listeners = ol.Object.getListeners(this);
|
||||||
@@ -166,7 +166,7 @@ ol.Object.prototype.bindTo =
|
|||||||
}, undefined, this);
|
}, undefined, this);
|
||||||
var accessors = ol.Object.getAccessors(this);
|
var accessors = ol.Object.getAccessors(this);
|
||||||
accessors[key] = {target: target, key: targetKey};
|
accessors[key] = {target: target, key: targetKey};
|
||||||
var noNotify = goog.isDef(opt_noNotify) ? opt_noNotify : false;
|
var noNotify = opt_noNotify || false;
|
||||||
if (!noNotify) {
|
if (!noNotify) {
|
||||||
this.notifyInternal_(key);
|
this.notifyInternal_(key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ ol.Store = function(projection, opt_extent, opt_attributions) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Extent}
|
* @type {ol.Extent}
|
||||||
*/
|
*/
|
||||||
this.extent_ = goog.isDef(opt_extent) ? opt_extent : projection.getExtent();
|
this.extent_ = opt_extent || projection.getExtent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<ol.Attribution>}
|
* @type {Array.<ol.Attribution>}
|
||||||
*/
|
*/
|
||||||
this.attributions_ = goog.isDef(opt_attributions) ? opt_attributions : null;
|
this.attributions_ = opt_attributions || null;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ ol.tilestore.BingMaps =
|
|||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.culture_ = goog.isDef(opt_culture) ? opt_culture : 'en-us';
|
this.culture_ = opt_culture || 'en-us';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -71,7 +71,7 @@ ol.tilestore.BingMaps =
|
|||||||
* @private
|
* @private
|
||||||
* @type {?function(ol.tilestore.BingMaps)}
|
* @type {?function(ol.tilestore.BingMaps)}
|
||||||
*/
|
*/
|
||||||
this.callback_ = goog.isDef(opt_callback) ? opt_callback : null;
|
this.callback_ = opt_callback || null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ ol.TileGrid = function(resolutions, extent, origin, opt_tileSize) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Size}
|
* @type {ol.Size}
|
||||||
*/
|
*/
|
||||||
this.tileSize_ = goog.isDef(opt_tileSize) ?
|
this.tileSize_ = opt_tileSize || new ol.Size(256, 256);
|
||||||
opt_tileSize : new ol.Size(256, 256);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ ol.tilestore.TileJSON = function(uri, opt_callback, opt_obj) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {?function(ol.tilestore.TileJSON)}
|
* @type {?function(ol.tilestore.TileJSON)}
|
||||||
*/
|
*/
|
||||||
this.callback_ = goog.isDef(opt_callback) ? opt_callback : null;
|
this.callback_ = opt_callback || null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ ol.TileStore = function(projection, tileGrid, tileUrlFunction, opt_extent,
|
|||||||
* @private
|
* @private
|
||||||
* @type {?string}
|
* @type {?string}
|
||||||
*/
|
*/
|
||||||
this.crossOrigin_ =
|
this.crossOrigin_ = opt_crossOrigin || 'anonymous';
|
||||||
goog.isDef(opt_crossOrigin) ? opt_crossOrigin : 'anonymous';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
Reference in New Issue
Block a user