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: add named arrow function for request and response handlers #805

Merged
merged 1 commit into from
Feb 25, 2017

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Aug 31, 2016

cherry-pick #804

@@ -125,15 +125,18 @@ module.exports = class Application extends Emitter {

callback() {
const fn = compose(this.middleware);
const self = this;
Copy link
Member Author

Choose a reason for hiding this comment

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

self come back again...

Copy link
Member

@jonathanong jonathanong left a comment

Choose a reason for hiding this comment

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

change back to named arrow function

@fengmk2 fengmk2 changed the title fix: add named function for request and response handlers fix: add named arrow function for request and response handlers Oct 19, 2016
@@ -128,13 +128,16 @@ module.exports = class Application extends Emitter {

if (!this.listeners('error').length) this.on('error', this.onerror);

return (req, res) => {
const handleRequest = (req, res) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

@jonathanong "named arrow function" back

@codecov-io
Copy link

codecov-io commented Oct 19, 2016

Current coverage is 100% (diff: 100%)

Merging #805 into v2.x will not change coverage

@@           v2.x   #805   diff @@
==================================
  Files         4      4          
  Lines       418    420     +2   
  Methods      80     80          
  Messages      0      0          
  Branches    100    100          
==================================
+ Hits        418    420     +2   
  Misses        0      0          
  Partials      0      0          

Powered by Codecov. Last update 2a16426...9afa847

@fengmk2
Copy link
Member Author

fengmk2 commented Oct 19, 2016

named arrow function const handleResponse = () => {} only work on node >= 6.

  • node 6.9.0
> const handleResponse = () => {}
> handleResponse
[Function: handleResponse]
> handleResponse.name
'handleResponse'
  • node 4.6.1
> const handleResponse = () => {}
> handleResponse
[Function]
> handleResponse.name
''

@jonathanong
Copy link
Member

named arrow function const handleResponse = () => {} only work on node >= 6.

o i c. i'm thinking maybe when we actually release koa v2, we only support node >= 8 since that's where await is native. or maybe this is a feature that can only work on node >= 6 and let it be known that it does not work on node v4

@iamchenxin
Copy link
Contributor

@jonathanong Its a nice idea only support node >= 8. Backward compatibility is not always good.

@jonathanong
Copy link
Member

going to merge this and only support node 7.6+ :)

@jonathanong jonathanong merged commit a7c4236 into v2.x Feb 25, 2017
@jonathanong jonathanong deleted the named-functions-for-2.x branch February 25, 2017 06:06
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.

6 participants