11/* global settings */
2- import $ from 'jquery'
3- import 'jquery-deparam'
2+ import deparam from 'jquery-deparam'
43import 'bootstrap/js/dist/collapse'
54
65import DatasetsList from './components/datasets-list'
@@ -9,12 +8,13 @@ import OrganizationsFilter from './components/organizations-filter'
98import DatasetDisplay from './components/dataset-display'
109import { queryByComponent } from './util'
1110
12- const params = $ . deparam ( window . location . search . substr ( 1 ) )
11+ const params = deparam ( window . location . search . substr ( 1 ) )
1312
1413// Helper function to ensure datasets.json is only fetched once per page
1514let datasetsCache
1615function getDatasets ( ) {
17- datasetsCache = datasetsCache || $ . getJSON ( `${ settings . BASE_URL } /datasets.json` )
16+ const url = `${ settings . BASE_URL } /datasets.json`
17+ datasetsCache = datasetsCache || fetch ( url ) . then ( ( response ) => response . json ( ) )
1818 return datasetsCache
1919}
2020
@@ -31,11 +31,11 @@ for (let component of components) {
3131 // If the component depends on datasets.json, fetch it first (once per page) and pass it
3232 if ( component . usesDatasets ) {
3333 getDatasets ( ) . then ( ( datasets ) => {
34- els . each ( ( index , el ) => new component . class ( { el : $ ( el ) , params, datasets} ) ) // eslint-disable-line
34+ els . forEach ( ( el ) => new component . class ( { el : el , params, datasets} ) ) // eslint-disable-line
3535 } )
3636 // Otherwise simply initialize the component
3737 } else {
38- els . each ( ( index , el ) => new component . class ( { el : $ ( el ) , params} ) ) // eslint-disable-line
38+ els . forEach ( ( el ) => new component . class ( { el : el , params} ) ) // eslint-disable-line
3939 }
4040 }
4141}
0 commit comments