-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use inherited mixins #666
Use inherited mixins #666
Conversation
…eds for async ops
- as a result, order is not important with map/webmap mixins
9043663
to
f3cf778
Compare
d997a06
to
9300ebb
Compare
@tmcgee @DavidSpriggs Can this be merged? |
@roemhildtg As you know for our conversations, I like this. I have not yet had time to run through it locally and consider how it relates to other mixins I have created/used and am considering. There might be a tweak or 2 as an outcome but I think it is good direction and very close to done. |
Sounds good, I just wanted to see where we're at. I have some additional mixin ideas and would like to have this merged before I started exploring those. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 places where promise/all
is included but not used.
1 change to the final call to createWidgets
viewer/js/viewer/_LayoutMixin.js
Outdated
@@ -11,6 +11,8 @@ define([ | |||
'dojo/dom-class', | |||
'dojo/dom-geometry', | |||
'dojo/sniff', | |||
'dojo/Deferred', | |||
'dojo/promise/all', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
promiseAll is not used in this Mixin
viewer/js/viewer/_MapMixin.js
Outdated
@@ -5,6 +5,7 @@ define([ | |||
'dojo/dom', | |||
'dojo/_base/array', | |||
'dojo/Deferred', | |||
'dojo/promise/all', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
promiseAll is not used in this Mixin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more then you can take that well-deserved day-off. 😉
viewer/js/viewer/_WebMapMixin.js
Outdated
@@ -2,6 +2,8 @@ define([ | |||
'dojo/_base/declare', | |||
'dojo/_base/lang', | |||
'dojo/_base/array', | |||
'dojo/promise/all', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
promiseAll is not used in this Mixin
viewer/js/viewer/_WidgetsMixin.js
Outdated
if (this.layoutDeferred) { | ||
promiseAll([this.mapDeferred, this.layoutDeferred]) | ||
.then(lang.hitch(this, | ||
'createWidgets', ['titlePane', 'contentPane', 'floating', 'domNode', 'invisible', 'layout'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this final call to createWidgets
should pass null or this.widgetTypes
. This allows the dev to not have to override this entire function if they add any custom widget types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Each widget can only be loaded once based on the key in the widgets
object (or the id property, if provided). The code in the createWidget
method checks to see if a widget with the same key/id has already been loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I saw that after I commented. (then I deleted my comment but you were too quick 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so now it looks like I was responding only to the voices in my head! 😮
After my review, I tested these changes with my WAB Widgets mixin, Calcite Maps mixin and my work-in-progress mixins for version 4.x of the Esri JavaScript API. As I expected, this required a few minor changes in the 4.x mixins. Other than that, it seemed to work well without a hitch. With this change, I think I might be able to remove some of the override functions in my mixins. nice work! |
viewer/js/viewer/_WidgetsMixin.js
Outdated
} | ||
if (this.layoutDeferred) { | ||
promiseAll([this.mapDeferred, this.layoutDeferred]) | ||
.then(lang.hitch(this, 'createWidgets')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have to pass an argument (null or this.widgetTypes). No widgets are created when you don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that this.widgetTypes
is used automatically here
widgetTypes = widgetTypes || this.widgetTypes;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link doesn't work but its line 75 of _WidgetsMixin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does't use this.widgetTypes
when it is called this way using lang.hitch
. I tried that before posting my original suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I see. since lang.hitch is passing the arguments from promiseAll.
viewer/js/viewer/_WidgetsMixin.js
Outdated
} | ||
}, | ||
|
||
createWidgets: function (widgetTypes) { | ||
debugger; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate it when I leave these in code! ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I swear I removed that...ahh, I must've staged it before I removed that line. Its my day off, I need a break :)
2a7f35a
to
ce28af2
Compare
this.inherited
loadConfig
- a method that can load and modify the config object before the app begins loadingpostConfig
- a method that can initialize app variables and perform any necessary operations after the config is loaded and processed, but before startup happensstartup
- a method that starts the app layout, map, widgets, etc