Skip to content
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

Merged
merged 16 commits into from
Feb 11, 2017
Merged

Use inherited mixins #666

merged 16 commits into from
Feb 11, 2017

Conversation

green3g
Copy link
Member

@green3g green3g commented Feb 1, 2017

  • make mixins less dependent on each other by implementing common methods and this.inherited
    • loadConfig - a method that can load and modify the config object before the app begins loading
    • postConfig - a method that can initialize app variables and perform any necessary operations after the config is loaded and processed, but before startup happens
    • startup - a method that starts the app layout, map, widgets, etc

@green3g
Copy link
Member Author

green3g commented Feb 6, 2017

@tmcgee @DavidSpriggs Can this be merged?

@tmcgee
Copy link
Member

tmcgee commented Feb 6, 2017

@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.

@green3g
Copy link
Member Author

green3g commented Feb 6, 2017

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.

@tmcgee tmcgee self-assigned this Feb 7, 2017
@tmcgee tmcgee added this to the v2.0.0-beta.1 milestone Feb 7, 2017
Copy link
Member

@tmcgee tmcgee left a 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

@@ -11,6 +11,8 @@ define([
'dojo/dom-class',
'dojo/dom-geometry',
'dojo/sniff',
'dojo/Deferred',
'dojo/promise/all',
Copy link
Member

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

@@ -5,6 +5,7 @@ define([
'dojo/dom',
'dojo/_base/array',
'dojo/Deferred',
'dojo/promise/all',
Copy link
Member

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

Copy link
Member

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. 😉

@@ -2,6 +2,8 @@ define([
'dojo/_base/declare',
'dojo/_base/lang',
'dojo/_base/array',
'dojo/promise/all',
Copy link
Member

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

if (this.layoutDeferred) {
promiseAll([this.mapDeferred, this.layoutDeferred])
.then(lang.hitch(this,
'createWidgets', ['titlePane', 'contentPane', 'floating', 'domNode', 'invisible', 'layout']
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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 😄 )

Copy link
Member

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! 😮

@tmcgee
Copy link
Member

tmcgee commented Feb 8, 2017

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!

}
if (this.layoutDeferred) {
promiseAll([this.mapDeferred, this.layoutDeferred])
.then(lang.hitch(this, 'createWidgets'));
Copy link
Member

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.

Copy link
Member Author

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;

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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.

}
},

createWidgets: function (widgetTypes) {
debugger;
Copy link
Member

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! ;)

Copy link
Member Author

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 :)

@tmcgee tmcgee merged commit 1feae77 into cmv:develop Feb 11, 2017
@green3g green3g deleted the use-inherited-mixins branch February 11, 2017 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants