Merge pull request #584 from marco-c/setZeroTimeout_when_possible

Use setZeroTimeout when possible
This commit is contained in:
Myk Melez 2014-11-13 17:18:08 -08:00
Родитель 1febd7502c 7802ddacec
Коммит b652f8efac
2 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -258,7 +258,7 @@ var fs = (function() {
path = normalizePath(path); path = normalizePath(path);
if (openedFiles.findIndex(file => file && file.path === path) != -1) { if (openedFiles.findIndex(file => file && file.path === path) != -1) {
setTimeout(() => cb(false), 0); setZeroTimeout(() => cb(false));
return; return;
} }
@ -407,7 +407,7 @@ var fs = (function() {
newPath = normalizePath(newPath); newPath = normalizePath(newPath);
if (openedFiles.findIndex(file => file && file.path === oldPath) != -1) { if (openedFiles.findIndex(file => file && file.path === oldPath) != -1) {
setTimeout(() => cb(false), 0); setZeroTimeout(() => cb(false));
return; return;
} }
@ -460,7 +460,7 @@ var fs = (function() {
var file = openedFiles.find(file => file && file.stat && file.path === path); var file = openedFiles.find(file => file && file.stat && file.path === path);
if (file) { if (file) {
setTimeout(() => cb(file.stat), 0); setZeroTimeout(() => cb(file.stat));
return; return;
} }

Просмотреть файл

@ -6,6 +6,7 @@
<meta name="viewport" content="initial-scale=1.0"> <meta name="viewport" content="initial-scale=1.0">
<script type="text/javascript" src="../libs/async_storage.js" defer></script> <script type="text/javascript" src="../libs/async_storage.js" defer></script>
<script type="text/javascript" src="../libs/fs.js" defer></script> <script type="text/javascript" src="../libs/fs.js" defer></script>
<script type="text/javascript" src="../timer.js" defer></script>
<script type="text/javascript"> <script type="text/javascript">
console.log = function() { console.log = function() {
var s = Array.prototype.join.call(arguments, ",") +"\n"; var s = Array.prototype.join.call(arguments, ",") +"\n";