Created
March 18, 2020 23:10
-
-
Save carmouche/df70ee8f45fc94fff9f9b90b649e7e64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {decorate, observable, action, runInAction} from 'mobx'; | |
class UploadProgress { | |
public totalPercent!: number; | |
constructor(initialPercent?: number) { | |
runInAction(() => { | |
this.totalPercent = initialPercent || 0; | |
}); | |
} | |
setTotalPercent = (totalPercent: number): void => { | |
this.totalPercent = totalPercent; | |
}; | |
} | |
decorate(UploadProgress, { | |
totalPercent: observable, | |
setTotalPercent: action | |
}); | |
export default UploadProgress; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment