Skip to content

Instantly share code, notes, and snippets.

@carmouche
Created March 18, 2020 23:10
Show Gist options
  • Save carmouche/df70ee8f45fc94fff9f9b90b649e7e64 to your computer and use it in GitHub Desktop.
Save carmouche/df70ee8f45fc94fff9f9b90b649e7e64 to your computer and use it in GitHub Desktop.
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