Skip to content

Commit f56ea57

Browse files
committed
container.Base: loadItems() => change param to be an object #6730
1 parent f70b268 commit f56ea57

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

examples/serverside/gridContainer/Viewport.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Viewport extends BaseViewport {
3131
async onLoadGridContainerButtonClick(data) {
3232
data.component.disabled = true;
3333

34-
let items = await this.loadItems('../../examples/serverside/gridContainer/resources/data/grid-container.json');
34+
let items = await this.loadItems({url: '../../examples/serverside/gridContainer/resources/data/grid-container.json'});
3535

3636
this.getReference('container').add(items)
3737
}

examples/serverside/toolbarItems/Viewport.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Viewport extends BaseViewport {
3030
async onLoadItemsButtonClick(data) {
3131
data.component.disabled = true;
3232

33-
let items = await this.loadItems('../../examples/serverside/toolbarItems/resources/data/toolbar-items.json');
33+
let items = await this.loadItems({url: '../../examples/serverside/toolbarItems/resources/data/toolbar-items.json'});
3434

3535
this.getReference('toolbar').add(items)
3636
}

src/container/Base.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,13 @@ class Container extends Component {
586586
* {"modules": [], "items": []}
587587
* See: https://github.com/neomjs/neo/blob/dev/examples/serverside/gridContainer/resources/data/grid-container.json
588588
* It is important to add modules which are not already imported inside your app yet.
589-
* @param {String} url
589+
* @param {Object} data
590+
* @param {Object} [data.options={}]
591+
* @param {String} data.url
590592
* @returns {Promise<Object[]>}
591593
*/
592-
async loadItems(url) {
593-
let response = await fetch(url),
594+
async loadItems({options={}, url}) {
595+
let response = await fetch(url, options),
594596
remoteData = await response.json();
595597

596598
if (remoteData.modules?.length > 0) {

0 commit comments

Comments
 (0)