MCPcopy Index your code
hub / github.com/TruthHun/BookStack / resolveAsyncComponent

Function resolveAsyncComponent

static/vuejs/vue.js:3120–3166  ·  view source on GitHub ↗
(
  factory,
  baseCtor,
  cb
)

Source from the content-addressed store, hash-verified

3118}
3119
3120function resolveAsyncComponent (
3121 factory,
3122 baseCtor,
3123 cb
3124) {
3125 if (factory.requested) {
3126 // pool callbacks
3127 factory.pendingCallbacks.push(cb);
3128 } else {
3129 factory.requested = true;
3130 var cbs = factory.pendingCallbacks = [cb];
3131 var sync = true;
3132
3133 var resolve = function (res) {
3134 if (isObject(res)) {
3135 res = baseCtor.extend(res);
3136 }
3137 // cache resolved
3138 factory.resolved = res;
3139 // invoke callbacks only if this is not a synchronous resolve
3140 // (async resolves are shimmed as synchronous during SSR)
3141 if (!sync) {
3142 for (var i = 0, l = cbs.length; i < l; i++) {
3143 cbs[i](res);
3144 }
3145 }
3146 };
3147
3148 var reject = function (reason) {
3149 "development" !== 'production' && warn(
3150 "Failed to resolve async component: " + (String(factory)) +
3151 (reason ? ("\nReason: " + reason) : '')
3152 );
3153 };
3154
3155 var res = factory(resolve, reject);
3156
3157 // handle promise
3158 if (res && typeof res.then === 'function' && !factory.resolved) {
3159 res.then(resolve, reject);
3160 }
3161
3162 sync = false;
3163 // return in case resolved synchronously
3164 return factory.resolved
3165 }
3166}
3167
3168function extractProps (data, Ctor, tag) {
3169 // we are only extracting raw values here.

Callers 1

createComponentFunction · 0.70

Calls 1

factoryFunction · 0.50

Tested by

no test coverage detected