MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / notify

Function notify

lib/web/polyfill.js:1307–1345  ·  view source on GitHub ↗
(record, reject)

Source from the content-addressed store, hash-verified

1305 }
1306 }
1307 function notify(record, reject){
1308 var chain = record.c;
1309 if(reject || chain.length)asap(function(){
1310 var promise = record.p
1311 , value = record.v
1312 , ok = record.s == 1
1313 , i = 0;
1314 if(reject && !handledRejectionOrHasOnRejected(promise)){
1315 setTimeout(function(){
1316 if(!handledRejectionOrHasOnRejected(promise)){
1317 if(NODE){
1318 if(!process.emit('unhandledRejection', value, promise)){
1319 // default node.js behavior
1320 }
1321 } else if(isFunction(console.error)){
1322 console.error('Unhandled promise rejection', value);
1323 }
1324 }
1325 }, 1e3);
1326 } else while(chain.length > i)!function(react){
1327 var cb = ok ? react.ok : react.fail
1328 , ret, then;
1329 try {
1330 if(cb){
1331 if(!ok)record.h = true;
1332 ret = cb === true ? value : cb(value);
1333 if(ret === react.P){
1334 react.rej(TypeError(PROMISE + '-chain cycle'));
1335 } else if(then = isThenable(ret)){
1336 then.call(ret, react.res, react.rej);
1337 } else react.res(ret);
1338 } else react.rej(value);
1339 } catch(err){
1340 react.rej(err);
1341 }
1342 }(chain[i++]);
1343 chain.length = 0;
1344 });
1345 }
1346 function resolve(value){
1347 var record = this
1348 , then, wrapper;

Callers 3

resolveFunction · 0.85
rejectFunction · 0.85
polyfill.jsFile · 0.85

Calls 6

cbFunction · 0.85
isThenableFunction · 0.85
isFunctionFunction · 0.70
errorMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected