Named export for ol/plugins
This commit is contained in:
@@ -2,23 +2,22 @@
|
||||
* @module ol/plugins
|
||||
*/
|
||||
import PluginType from './PluginType.js';
|
||||
var _ol_plugins_ = {};
|
||||
|
||||
/**
|
||||
* The registry of map renderer plugins.
|
||||
* @type {Array<olx.MapRendererPlugin>}
|
||||
* @private
|
||||
*/
|
||||
_ol_plugins_.mapRendererPlugins_ = [];
|
||||
var mapRendererPlugins = [];
|
||||
|
||||
|
||||
/**
|
||||
* Get all registered map renderer plugins.
|
||||
* @return {Array<olx.MapRendererPlugin>} The registered map renderer plugins.
|
||||
*/
|
||||
_ol_plugins_.getMapRendererPlugins = function() {
|
||||
return _ol_plugins_.mapRendererPlugins_;
|
||||
};
|
||||
export function getMapRendererPlugins() {
|
||||
return mapRendererPlugins;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -26,16 +25,16 @@ _ol_plugins_.getMapRendererPlugins = function() {
|
||||
* @type {Array<olx.LayerRendererPlugin>}
|
||||
* @private
|
||||
*/
|
||||
_ol_plugins_.layerRendererPlugins_ = [];
|
||||
var layerRendererPlugins = [];
|
||||
|
||||
|
||||
/**
|
||||
* Get all registered layer renderer plugins.
|
||||
* @return {Array<olx.LayerRendererPlugin>} The registered layer renderer plugins.
|
||||
*/
|
||||
_ol_plugins_.getLayerRendererPlugins = function() {
|
||||
return _ol_plugins_.layerRendererPlugins_;
|
||||
};
|
||||
export function getLayerRendererPlugins() {
|
||||
return layerRendererPlugins;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -43,16 +42,16 @@ _ol_plugins_.getLayerRendererPlugins = function() {
|
||||
* @param {ol.PluginType} type The plugin type.
|
||||
* @param {*} plugin The plugin.
|
||||
*/
|
||||
_ol_plugins_.register = function(type, plugin) {
|
||||
export function register(type, plugin) {
|
||||
var plugins;
|
||||
switch (type) {
|
||||
case PluginType.MAP_RENDERER: {
|
||||
plugins = _ol_plugins_.mapRendererPlugins_;
|
||||
plugins = mapRendererPlugins;
|
||||
plugins.push(/** @type {olx.MapRendererPlugin} */ (plugin));
|
||||
break;
|
||||
}
|
||||
case PluginType.LAYER_RENDERER: {
|
||||
plugins = _ol_plugins_.layerRendererPlugins_;
|
||||
plugins = layerRendererPlugins;
|
||||
plugins.push(/** @type {olx.LayerRendererPlugin} */ (plugin));
|
||||
break;
|
||||
}
|
||||
@@ -60,7 +59,7 @@ _ol_plugins_.register = function(type, plugin) {
|
||||
throw new Error('Unsupported plugin type: ' + type);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -68,9 +67,8 @@ _ol_plugins_.register = function(type, plugin) {
|
||||
* @param {ol.PluginType} type The plugin type.
|
||||
* @param {Array} plugins The plugins.
|
||||
*/
|
||||
_ol_plugins_.registerMultiple = function(type, plugins) {
|
||||
export function registerMultiple(type, plugins) {
|
||||
for (var i = 0, ii = plugins.length; i < ii; ++i) {
|
||||
_ol_plugins_.register(type, plugins[i]);
|
||||
register(type, plugins[i]);
|
||||
}
|
||||
};
|
||||
export default _ol_plugins_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user