Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

t/16: Introduced the configuration API #19

Merged
merged 5 commits into from Mar 2, 2015
Merged

t/16: Introduced the configuration API #19

merged 5 commits into from Mar 2, 2015

Conversation

fredck
Copy link
Contributor

@fredck fredck commented Feb 27, 2015

get: function( name ) {
// The target for this configuration is, for now, this object.
//jscs:disable safeContextKeyword
var source = this;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this variable? And why it's sometimes called source and sometimes target? I suggest to follow common approach and call them that or self .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a trick to reference this inside inner-functions. That's not the case here.

You should read the rest of the code... here source (on get()) and target (on set()) refer to the source/target object for the configurations, which at start is this but then eventually moves to child properties of this. Therefore a more semantical name is used for the variable and unfortunately the jscs rules we have applied are too strict for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

y, it make sense - good naming.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I see now, my bad.

@gregpabian gregpabian self-assigned this Mar 2, 2015
* @param {*} [value] The configuration value. Used if a name is passed to nameOrConfigurations. If undefined,
* the configuration is set to `null`.
*/
define: function( name, value ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really convinced to the name of this method... Wouldn't it make more sense to name it default and store its values in this.defaults?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm out of context right now so ignore my message if it misses the point. But I remember that defining config properties was aimed at not only defining defaults, but also what configuration options are out there (possible validation).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aimed at not only defining defaults, but also what configuration options are out there (possible validation)

Exactly... that's why it's named "define".

@gregpabian gregpabian removed their assignment Mar 2, 2015
@fredck fredck removed the review- label Mar 2, 2015
@fredck
Copy link
Contributor Author

fredck commented Mar 2, 2015

Ok, minor fixes applied. Ready for review again.

@gregpabian gregpabian assigned gregpabian and unassigned gregpabian Mar 2, 2015
@gregpabian
Copy link
Contributor

What about all those assertions we discussed earlier? Are you gonna address them now or while resolving #20?

@fredck
Copy link
Contributor Author

fredck commented Mar 2, 2015

What about all those assertions we discussed earlier? Are you gonna address them now or while resolving #20?

Let's do all in a roll right after closing this PR, if you don't mind.

@gregpabian
Copy link
Contributor

Alright, so if there is no more comments, then I'm OK with closing this one.

gregpabian added a commit that referenced this pull request Mar 2, 2015
t/16: Introduced the configuration API
@gregpabian gregpabian merged commit acd72a0 into ckeditor:master Mar 2, 2015
@gregpabian gregpabian deleted the t/16 branch March 2, 2015 14:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants