-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
onProgress option added #52
Conversation
I don't know how to correctly reflect the changes for |
index.js
Outdated
@@ -65,6 +65,10 @@ const cpFile = (sourcePath, destinationPath, options) => { | |||
const progressEmitter = new ProgressEmitter(path.resolve(sourcePath), path.resolve(destinationPath)); | |||
const promise = cpFileAsync(sourcePath, destinationPath, options, progressEmitter); | |||
|
|||
if (typeof options.onProgress === 'function') { | |||
progressEmitter.on('progress', options.onProgress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be the inverse. .on
should use onProgress
. This would make it easier to remove the deprecated .on
method in a future release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't understand. How can promise.on
use options.onProgress
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretend that promise.on
and progressEmitter
doesn't exist and try to implement options.onProgress
. That what the implementation should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense but promise.on
handles it on a different phase (chained). I can try to rewrite it this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found a way to cover deprecated implementation through options
mutation but I am not sure about that.
Can you fix the merge conflict? |
Co-authored-by: Sindre Sorhus <[email protected]>
Friendly bump :) |
Fixes #51
.on()
has been deprecatedonProgress
option (async mode only)