@@ -5,10 +5,13 @@ import { objType, createElement, cloneNode, unitConvert } from './utils.js';
55/* ----- CONSTRUCTOR ----- */
66
77var Worker = function Worker ( opt ) {
8- var self = Object . assign ( Worker . convert ( Promise . resolve ( ) ) , Worker . template ) ;
8+ // Create the root parent for the proto chain, and the starting Worker.
9+ var root = Object . assign ( Worker . convert ( Promise . resolve ( ) ) , Worker . template ) ;
10+ var self = Worker . convert ( Promise . resolve ( ) , root ) ;
911
10- self . set ( opt ) ;
12+ // Set progress, optional settings, and return.
1113 self . setProgress ( 1 , Worker , 1 , [ Worker ] ) ;
14+ self . set ( opt ) ;
1215 return self ;
1316} ;
1417
@@ -423,7 +426,7 @@ Worker.prototype.then = function then(onFulfilled, onRejected) {
423426 } ) ;
424427
425428 // Return the promise, after casting it into a Worker and preserving props.
426- return Worker . convert ( returnVal , self ) ;
429+ return Worker . convert ( returnVal , self . __proto__ ) ;
427430} ;
428431
429432Worker . prototype . thenCore = function thenCore ( onFulfilled , onRejected ) {
@@ -436,7 +439,7 @@ Worker.prototype.thenCore = function thenCore(onFulfilled, onRejected) {
436439
437440 // Return the promise, after casting it into a Worker and preserving props.
438441 var returnVal = Promise . prototype . then . call ( self , onFulfilled , onRejected ) ;
439- return Worker . convert ( returnVal , self ) ;
442+ return Worker . convert ( returnVal , self . __proto__ ) ;
440443} ;
441444
442445Worker . prototype [ 'catch' ] = function ( onRejected ) {
0 commit comments