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

Feature: Introduce bind().toMany() binding chain in ObservableMixin. #225

Merged
merged 1 commit into from
Feb 8, 2018

Conversation

Reinmar
Copy link
Member

@Reinmar Reinmar commented Feb 8, 2018

Suggested merge commit message (convention)

Type: Feature: Introduce bind().toMany() binding chain in ObservableMixin. Closes ckeditor/ckeditor5#4994.

@Reinmar Reinmar merged commit cfa7d0e into master Feb 8, 2018
@Reinmar Reinmar deleted the t/ckeditor5-ui/344 branch February 8, 2018 14:11
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling b755087 on t/ckeditor5-ui/344 into dc6b226 on master.

// @param {String} attribute
// @returns {Array.<String>}
function getBindingTargets( observables, attribute ) {
return Array.prototype.concat( ...observables.map( observable => [ observable, attribute ] ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't it be just that:

return observables.map( observable => [ observable, attribute ] );

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems so. I admit that I haven't even looked at the 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.

Ah, no. It needs to be a concat() call. Because it takes [1,2],[3,4],... arrays and returns [1,2,3,4...]. Am I right, @jodator?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, after short analyzing I've found that it might be correct as the result of this fn is [ observable1, attribute, observable2, attribute ... ].

But docs are incorrect here anyway, observables can't be here iterable and the return type is different.

Copy link
Member Author

Choose a reason for hiding this comment

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

Feel free to fix :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah - return type should be Array.<Observable|String> as the result is as @ma2ciek wrote.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I'll change it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce Observable#bind()#toMany()
4 participants