mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Drop Knockout.js loading components asynchronous
https://knockoutjs.com/documentation/component-registration.html#controlling-synchronousasynchronous-loading
This commit is contained in:
parent
ef8b1f40e4
commit
d1f71508fe
2 changed files with 4 additions and 12 deletions
|
|
@ -8,7 +8,7 @@ knockoutDebugCallback([
|
||||||
'src/utils.domNodeDisposal.js',
|
'src/utils.domNodeDisposal.js',
|
||||||
// 'src/utils.domManipulation.js',
|
// 'src/utils.domManipulation.js',
|
||||||
// 'src/memoization.js',
|
// 'src/memoization.js',
|
||||||
'src/tasks.js',
|
// 'src/tasks.js',
|
||||||
'src/subscribables/extenders.js',
|
'src/subscribables/extenders.js',
|
||||||
'src/subscribables/subscribable.js',
|
'src/subscribables/subscribable.js',
|
||||||
'src/subscribables/dependencyDetection.js',
|
'src/subscribables/dependencyDetection.js',
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,10 @@
|
||||||
ko.components = {
|
ko.components = {
|
||||||
get: (componentName, callback) => {
|
get: (componentName, callback) => {
|
||||||
if (loadedDefinitionsCache.has(componentName)) {
|
if (loadedDefinitionsCache.has(componentName)) {
|
||||||
ko.tasks.schedule(() => callback(loadedDefinitionsCache.get(componentName)));
|
callback(loadedDefinitionsCache.get(componentName));
|
||||||
} else {
|
} else {
|
||||||
// Join the loading process that is already underway, or start a new one.
|
// Join the loading process that is already underway, or start a new one.
|
||||||
var subscribable = loadingSubscribablesCache[componentName],
|
var subscribable = loadingSubscribablesCache[componentName];
|
||||||
completedAsync;
|
|
||||||
if (subscribable) {
|
if (subscribable) {
|
||||||
subscribable.subscribe(callback);
|
subscribable.subscribe(callback);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -27,15 +26,8 @@
|
||||||
//
|
//
|
||||||
// You can bypass the 'always asynchronous' feature by putting the synchronous:true
|
// You can bypass the 'always asynchronous' feature by putting the synchronous:true
|
||||||
// flag on your component configuration when you register it.
|
// flag on your component configuration when you register it.
|
||||||
if (completedAsync) {
|
subscribable.notifySubscribers(definition);
|
||||||
// Note that notifySubscribers ignores any dependencies read within the callback.
|
|
||||||
// See comment in loaderRegistryBehaviors.js for reasoning
|
|
||||||
subscribable.notifySubscribers(definition);
|
|
||||||
} else {
|
|
||||||
ko.tasks.schedule(() => subscribable.notifySubscribers(definition));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
completedAsync = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue