MCPcopy Index your code
hub / github.com/totaljs/framework / refresh

Function refresh

debug.js:255–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

253 }
254
255 function refresh() {
256 var reload = false;
257 Object.keys(files).wait(function(filename, next) {
258 Fs.stat(filename, function(err, stat) {
259
260 var stamp = makestamp();
261
262 if (err) {
263 delete files[filename];
264 var tmp = isViewPublic(filename);
265 var log = stamp.replace('#', 'REM') + prefix + normalize(filename.replace(directory, ''));
266 if (tmp) {
267 if (isBUNDLE) {
268 Fs.unlinkSync(Path.join(SRC, tmp));
269 console.log(log);
270 }
271 reload = true;
272 } else {
273 changes.push(log);
274 force = true;
275 }
276 } else {
277
278 var ticks = stat.mtime.getTime();
279
280 if (files[filename] != null && files[filename] !== ticks) {
281
282 if (filename.endsWith('.bundle') && files[filename.replace(/\.bundle$/, '.url')]) {
283 // Bundle from URL address
284 files[filename] = ticks;
285 next();
286 return;
287 }
288
289 var log = stamp.replace('#', files[filename] === 0 ? 'ADD' : 'UPD') + prefix + normalize(filename.replace(directory, ''));
290 if (files[filename]) {
291 var tmp = isViewPublic(filename);
292 if (tmp) {
293 var skip = true;
294 if (isBUNDLE) {
295 if (filename.lastIndexOf('--') === -1)
296 copyFile(filename, Path.join(SRC, tmp));
297 else
298 skip = false;
299 }
300 if (skip) {
301 files[filename] = ticks;
302 reload = true;
303 next();
304 return;
305 }
306 }
307 }
308
309 changes.push(log);
310 force = true;
311 }
312 files[filename] = ticks;

Callers 1

onCompleteFunction · 0.85

Calls 7

makestampFunction · 0.85
isViewPublicFunction · 0.85
livereloadFunction · 0.85
restartFunction · 0.85
normalizeFunction · 0.70
nextFunction · 0.70
copyFileFunction · 0.70

Tested by

no test coverage detected