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

Exported source factory #78

Closed
wants to merge 2 commits into from

Conversation

Venipa
Copy link

@Venipa Venipa commented Aug 30, 2019

#77

@odahcam
Copy link
Collaborator

odahcam commented Aug 30, 2019

Not sure if this is the best way to expose the class, but it is a very interesting idea.

Copy link
Contributor

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

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

I don't think the factory should be exposed as is, because of async sources. An async source must be handled differently and you cannot just use getAvatar().

In order to expose the factory, we should modify our Source interface, so that it can always be handled in the same way, something like:

-  getAvatar(size: number): string | null;
+  getAvatar(size: number): Observable<string | null>;

This would also probably simplify our own code...

@odahcam
Copy link
Collaborator

odahcam commented Apr 22, 2020

The motivation for this is to have the ability to generate avatar URLs trough script instead of HTML, so why not to export the sources instead of the factory? In that way we gotta do less work (which means less risk), users will be able to have the same ability and we won't have to deal with Source interface changes for now, that would speed up acceptance.

@odahcam odahcam closed this Apr 22, 2020
@PowerKiKi
Copy link
Contributor

I wouldn't export source implementations, because that would open up a huge new API surface, and that would prevent us from breaking it (as we just did in the several past PRs).

Actually I would suggest to either:

  • do nothing at all and let the user re-implement whatever he needs (it's mostly one liners)
  • create and export a new Pipe while keeping our implementation details hidden, if it really is needed

@odahcam
Copy link
Collaborator

odahcam commented Apr 22, 2020

I don't mind about a new API surface, we can let users be responsible for how they use it. We could also separate the URL methods in pure functions and export just them. The Pipe idea seems nice too, but seems to be the harder to implement.

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

Successfully merging this pull request may close these issues.

3 participants