Files
carto-4.2.2-1.js/src/api/v4/style/base.js
T
2024-05-23 15:34:45 +08:00

34 lines
653 B
JavaScript

var _ = require('underscore');
var Backbone = require('backbone');
/**
* Base style object.
*
* @fires error
* @constructor
* @abstract
* @memberof carto.style
* @api
*/
function Base () {}
_.extend(Base.prototype, Backbone.Events);
Base.prototype.$setError = function (cartoError) {
this._error = cartoError;
this.trigger('error', cartoError);
};
Base.prototype.$setEngine = function (newEngine) {
if (this._engine && this._engine !== newEngine) {
throw new Error('CartoCSS engine cannot be changed');
}
this._engine = newEngine;
};
Base.prototype.$getEngine = function () {
return this._engine;
};
module.exports = Base;