mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 15:08:28 +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.domManipulation.js',
|
||||
// 'src/memoization.js',
|
||||
'src/tasks.js',
|
||||
// 'src/tasks.js',
|
||||
'src/subscribables/extenders.js',
|
||||
'src/subscribables/subscribable.js',
|
||||
'src/subscribables/dependencyDetection.js',
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@
|
|||
ko.components = {
|
||||
get: (componentName, callback) => {
|
||||
if (loadedDefinitionsCache.has(componentName)) {
|
||||
ko.tasks.schedule(() => callback(loadedDefinitionsCache.get(componentName)));
|
||||
callback(loadedDefinitionsCache.get(componentName));
|
||||
} else {
|
||||
// Join the loading process that is already underway, or start a new one.
|
||||
var subscribable = loadingSubscribablesCache[componentName],
|
||||
completedAsync;
|
||||
var subscribable = loadingSubscribablesCache[componentName];
|
||||
if (subscribable) {
|
||||
subscribable.subscribe(callback);
|
||||
} else {
|
||||
|
|
@ -27,15 +26,8 @@
|
|||
//
|
||||
// You can bypass the 'always asynchronous' feature by putting the synchronous:true
|
||||
// flag on your component configuration when you register it.
|
||||
if (completedAsync) {
|
||||
// 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));
|
||||
}
|
||||
subscribable.notifySubscribers(definition);
|
||||
});
|
||||
completedAsync = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue