-
Notifications
You must be signed in to change notification settings - Fork 107
Should esriLoader.require()'s promise resolve an object instead of an array #72
Comments
Just to clarify - this would only change the behavior in the case where a user requires more than one module (i.e. passes in an array of module names instead of a string) and used the returned promise (i.e. the callback would still receive an array of modules). |
@tomwayson I think it is a good idea how you propose to do dot notation properties. I can live with the current style of
Just a thought. As I mentioned, I like your proposal for property lookup as well in the resolved promise. |
...then(function(Map, FeatureLayer) {}); is not possible. Promises can only resolve to a single value. If you called the above statement, every argument after If no one else is bothered by the current implementation (array of modules) I'll probably leave it as is... so many other fish to fry. |
Aha, yeah...that thought made sense early this morning, but I completely see why that doesn't fly. I really need to stop trying to make intelligent-sounding comments on here pre-caffeine. Thanks for clarifying, @tomwayson. I still vote for your composite object of modules, if we get a chance to revisit this discussion. |
I think this proposal is a better API, and now is the time to change it if we're going to. The only thing holding me back is that I have zero energy to do effectively do a lightweight implementation of _.set. Also, no one else has chimed in on this, so doesn't seem like anyone else sees value in it. Thoughts @jwasil? |
Agreed, the proposal is 👍. However, I have been using the 2nd arg callback style lately anyways, just as in the new custom-directive test page, so I haven't really had to face this. I'm asking because I am genuinely curious and want to understand if I'm not taking into account other use-cases: is it worth offering this in the first place? EDIT: I mean as a public-facing API is it worth making the change? For example, internally use If either of us spend time in esriLoader, I think it could benefit from some additional modifications, such as:
|
Would the reason to inject |
Hmm yeah I suppose that's the only solid reason I can come up with to be honest. Can reasses when actually writing unit tests. May be an unnecessary item. |
Gonna try it out anyways |
FYI - #140 is may cause many a merge conflict. May want to review/merge that before starting on anything (hope I'm not too late). |
Let's cancel this, as discussed, due to jsapi naming conventions. Won't be so bad to implement again if we want to in the future. |
I know we've already had this discussion but I wonder if the promise was resolved with an object that contained the required modules as properties if it would be easier to work with instead of an array. The only trick would be making sure there are no name conflicts in the prorperties, but we could just replace the
/
characters with.
characters.To me, this:
Is better than this:
Just want to get input on this before #69.
The text was updated successfully, but these errors were encountered: