I've been trying this without success.
These are my steps:
- I made a new file in the source dir: (.\src\controls\MyLayerSelector.js)
Content:
import $ from 'jquery'
import {LayerSelector} from './LayerSelector'
export class MyLayerSelector extends LayerSelector {
buildLayerButton (layer, $target) {
super.buildLayerButton(layer, $target)
$button = $target.children(':last-child') // <- this should be your button as a jquery object
}
}
Edit entry.js. I've added this line:
import { MyLayerSelector } from '../../src/Controls/MyLayerSelector'
Edit entry.js. I've also added this line:
window.createG4U = function (target, clientConf = defaultClientConf, layerConf = defaultLayerConf) {
return createG4UInternal(target, clientConf, layerConf, [
new MyLayerSelector()
])
}
NPM run build output:
warnings:
[ './src/Controls/Control.js\nThere is another module with an equal name when case is ignored.\nThis can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\nRename module if multiple modules are expected or use equal casing if one module is expected.',
'./src/controls/Control.js\nThere is another module with an equal name when case is ignored.\nThis can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\nRename module if multiple modules are expected or use equal casing if one module is expected.',
'./src/Controls/LayerSelector.js\nThere is another module with an equal name when case is ignored.\nThis can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\nRename module if multiple modules are expected or use equal casing if one module is expected.',
'./src/controls/LayerSelector.js\nThere is another module with an equal name when case is ignored.\nThis can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\nRename module if multiple modules are expected or use equal casing if one module is expected.',
'./src/Controls/ControlLogicMixin.js\nThere is another module with an equal name when case is ignored.\nThis can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\nRename module if multiple modules are expected or use equal casing if one module is expected.',
'./src/controls/ControlLogicMixin.js\nThere is another module with an equal name when case is ignored.\nThis can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\nRename module if multiple modules are expected or use equal casing if one module is expected.' ]
When I ignore these warnings I get a javascript error:
Uncaught TypeError: Cannot read property 'selectL10N' of undefined