Changed JS functions notation
function createDataSourceRequestAddress(options) {
const datasourceEndpoint = Granite.HTTP.externalize(OPTION_PROVIDER_ENDPOINT);
const searchParams = new URLSearchParams();
- $.each(options, function (key, value) {
+ $.each(options, (key, value) => {
searchParams.append(key, value);
});
return datasourceEndpoint + '?' + searchParams.toString();
*/
function setOptionsAndRestoreSelected($select, options, resourceAddr, valueMember) {
$.get(resourceAddr)
- .then(function (resource) {
+ .then(resource => {
const storedValue = resource[valueMember];
$select.attr(STORED_VALUE_ATTRIBUTE, storedValue);
setOptions($select, options, storedValue);
})
- .fail(function() {
+ .fail(() => {
setOptions($select, options);
});
const dataSourceAddress = createDataSourceRequestAddress(options);
$.get(dataSourceAddress)
- .then(function(newOptions) {
+ .then(newOptions => {
processNewOptions($select, newOptions, resourceAddress, valueMember);
})
- .fail(function() {
+ .fail(() => {
setOptions($select, []);
});
});
