Class: SymbolCheck

SymbolCheck()

new SymbolCheck()

A utility class providing methods to check for symbols of OpenLayers we depend upon. This class can be mixed into classes to check if the dependencies to external symbols are fulfilled. An example: Ext.define('MyNewClass.DependingOnOpenLayersClasses', { mixins: ['GeoExt.mixin.SymbolCheck'], // the contents of the `symbols` property will be checked symbols: [ 'ol.Map', // checking a class 'ol.View.prototype.constrainResolution', // an instance method 'ol.control.ScaleLine#getUnits', // other way for instance method 'ol.color.asArray', // one way to reference a static method 'ol.color::asString' // other way to reference a static method ] // … your configuration and methods … }); Since this sort of checking usually only makes sense in debug mode, you can additionally wrap the `symbols`-configuration in these ``-line comments: Ext.define('MyNewClass.DependingOnOpenLayersClasses', { mixins: ['GeoExt.mixin.SymbolCheck'], // symbols: [] // }); This means that the array of symbols is not defined in production builds as the wrapped lines are simply removed from the final JavaScript. If one of the symbols cannot be found, a warning will be printed to the developer console (via `Ext.log.warn`, which will only print in a debug build): [W] The class "MyNewClass.DependingOnOpenLayersClasses" depends on the external symbol "ol.color.notExisting", which does not seem to exist.
Source: