July 2017
Intermediate to advanced
300 pages
5h 43m
English
The module handling the file list works pretty similar to the one we have just examined previously:
./js/View/FileList.js
const filesize = require( "filesize" ); class FileListView { constructor( boundingEl, dirService ){ this.dir = dirService; this.el = boundingEl; // Subscribe on DirService updates dirService.on( "update", () => this.update( dirService.getFileList() ) ); } static formatTime( timeString ){ const date = new Date( Date.parse( timeString ) ); return date.toDateString(); } update( collection ) { this.el.innerHTML = `<li class="file-list__li file-list__head"> <span class="file-list__li__name">Name</span> <span class="file-list__li__size">Size</span> <span class="file-list__li__time">Modified</span> ...Read now
Unlock full access