Skip to content

Instantly share code, notes, and snippets.

@tienthanhjlw
Created November 6, 2020 04:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tienthanhjlw/daeca309e36931375456dfd9a6041d3f to your computer and use it in GitHub Desktop.
Save tienthanhjlw/daeca309e36931375456dfd9a6041d3f to your computer and use it in GitHub Desktop.
Split array data
splitToShowData() {
this.dataTableShow$ = from([]);
const paths = _.chunk(this.dataTable, 25);
let list = [];
if (paths && paths.length) {
this.layoutService.isShowLoadingBar.next(true);
this.dataTableShow$ = from(paths[0]);
this.dataTableShow$ = interval(300).take(paths.length).map((i) => {
if (i == 0) {
list = [];
}
list = list.concat(paths[i]);
if (i == paths.length - 1) {
setTimeout(() => {
this.layoutService.isShowLoadingBar.next(false);
}, 1000);
}
return list;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment