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

Function resolveAsyncComponent

static/vuejs/vue.runtime.esm.js:3114–3160  ·  view source on GitHub ↗
(
  factory,
  baseCtor,
  cb
)

Source from the content-addressed store, hash-verified

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

Callers 1

createComponentFunction · 0.70

Calls 1

factoryFunction · 0.50

Tested by

no test coverage detected