Esri / application-boilerplate-3x-js

Starter application that simplifies the process of building templates for the ArcGIS.com template gallery.
https://developers.arcgis.com/javascript/
Apache License 2.0
90 stars 68 forks source link

feat: Adds error handling for async operations, moves boilerplate to factory function #112

Closed nicksenger closed 7 years ago

nicksenger commented 7 years ago

111

@driskull

Hey Matt, I don't expect this to be merged directly but I thought I would put it here since you are in the process of rewriting this boilerplate. It's just some refactoring that made sense in the context of how I'm setting up the embedded group gallery app.

Most of the boilerplate logic is the same as before, but it's moved from a class to a factory function that returns the boilerplate results as an object literal. I tried to clarify the asynchronous requests a bit and also added some error handling (turns out my original issue this morning was with the PortaItems not firing then()).

The only other big change is that it provides a scaffold for structuring the application using the js api 4.x widget framework.

driskull commented 7 years ago

very cool @nicksenger.

I'll go through and take the things that I haven't done yet. Although I rewrote almost all of it and I think its structured a lot better now. Still a few things to do though.

The only other big change is that it provides a scaffold for structuring the application using the js api 4.x widget framework.

I was debating doing this. I'll see what you got.

Most of the boilerplate logic is the same as before, but it's moved from a class to a factory function that returns the boilerplate results as an object literal

Was debating this as well but sticking with a class for now. Since querying for group items still needs a method.

nicksenger commented 7 years ago

Yeah I'm not really sure why i switched to a closure - more familiar with them I guess. You can simulate public methods by tacking a function on the exported object, but in the end it's 6 of one, half dozen of the other :]

driskull commented 7 years ago

@nicksenger could you look at the latest 4masterts and let me know your thoughts?