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

fix: Improve transport-commons types #1396

Merged
merged 1 commit into from
Jun 17, 2019

Conversation

vonagam
Copy link
Member

@vonagam vonagam commented Jun 12, 2019

Normalise types of PublishMixin, ServiceAddons and Application for publish/registerPublish:

  • an event is string or ALL_EVENTS symbol.
  • callback is now publisher in argument and variable naming.
  • a publisher returns a channel, an array of channels, void or a promise* for those.
  • return value is this.

* - before a promise was not present in types and not mentioned in documentation, but based on this line it is possible currently to return a promise. We can remove this feature from types and remove Promise.resolve from that line if this should not be supported.

Plus small performance improving in publishing: no point in creating array, using _.get and then .find with typeof when simple or condition will do (ideally publisher should be cached).

@daffl daffl merged commit f9d8536 into feathersjs:master Jun 17, 2019
@daffl
Copy link
Member

daffl commented Jun 17, 2019

Nice, thank you! Will go out with the next pre-release.

@vonagam vonagam deleted the fix-transport-types branch June 18, 2019 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants