src/common/js/winjs/js/base.js
function PageControl_ctor(element, options, complete, parentedPromise) {
                    var that = this;
                    this._disposed = false;
                    this.element = element = element || _Global.document.createElement("div");
                    _ElementUtilities.addClass(element, "win-disposable");
                    element.msSourceLocation = uri;
                    this.uri = uri;
                    this.selfhost = selfhost(uri);
                    element.winControl = this;
                    _ElementUtilities.addClass(element, "pagecontrol");

                    var profilerMarkIdentifier = " uri='" + uri + "'" + _BaseUtils._getProfilerMarkIdentifier(this.element);

                    _WriteProfilerMark("WinJS.UI.Pages:createPage" + profilerMarkIdentifier + ",StartTM");

                    var load = Promise.wrap().
                        then(function Pages_load() { return that.load(uri); });

                    var renderCalled = load.then(function Pages_init(loadResult) {
                        return Promise.join({
                            loadResult: loadResult,
                            initResult: that.init(element, options)
                        });
                    }).then(function Pages_render(result) {
                        return that.render(element, options, result.loadResult);
                    });

                    this.elementReady = renderCalled.then(function () { return element; });

                    this.renderComplete = renderCalled.
                        then(function Pages_process() {
                            return that.process(element, options);
                        }).then(function Pages_processed() {
                            return that.processed(element, options);
                        }).then(function () {
                            return that;
                        });

                    var callComplete = function () {
                        complete && complete(that);
                        _WriteProfilerMark("WinJS.UI.Pages:createPage" + profilerMarkIdentifier + ",StopTM");
                    };

                    // promises guarantee order, so this will be called prior to ready path below
                    //
                    this.renderComplete.then(callComplete, callComplete);

                    this.readyComplete = this.renderComplete.then(function () {
                        return parentedPromise;
                    }).then(function Pages_ready() {
                        that.ready(element, options);
                        return that;
                    }).then(
                        null,
                        function Pages_error(err) {
                            return that.error(err);
                        }
                    );
                }
function PageControl_ctor(element, options, complete, parentedPromise) {
                    var that = this;
                    this._disposed = false;
                    this.element = element = element || _Global.document.createElement("div");
                    _ElementUtilities.addClass(element, "win-disposable");
                    element.msSourceLocation = uri;
                    this.uri = uri;
                    this.selfhost = selfhost(uri);
                    element.winControl = this;
                    _ElementUtilities.addClass(element, "pagecontrol");

                    var profilerMarkIdentifier = " uri='" + uri + "'" + _BaseUtils._getProfilerMarkIdentifier(this.element);

                    _WriteProfilerMark("WinJS.UI.Pages:createPage" + profilerMarkIdentifier + ",StartTM");

                    var load = Promise.wrap().
                        then(function Pages_load() { return that.load(uri); });

                    var renderCalled = load.then(function Pages_init(loadResult) {
                        return Promise.join({
                            loadResult: loadResult,
                            initResult: that.init(element, options)
                        });
                    }).then(function Pages_render(result) {
                        return that.render(element, options, result.loadResult);
                    });

                    this.elementReady = renderCalled.then(function () { return element; });

                    this.renderComplete = renderCalled.
                        then(function Pages_process() {
                            return that.process(element, options);
                        }).then(function Pages_processed() {
                            return that.processed(element, options);
                        }).then(function () {
                            return that;
                        });

                    var callComplete = function () {
                        complete && complete(that);
                        _WriteProfilerMark("WinJS.UI.Pages:createPage" + profilerMarkIdentifier + ",StopTM");
                    };

                    // promises guarantee order, so this will be called prior to ready path below
                    //
                    this.renderComplete.then(callComplete, callComplete);

                    this.readyComplete = this.renderComplete.then(function () {
                        return parentedPromise;
                    }).then(function Pages_ready() {
                        that.ready(element, options);
                        return that;
                    }).then(
                        null,
                        function Pages_error(err) {
                            return that.error(err);
                        }
                    );
                }
function PageControl_ctor ( element , options , complete , parentedPromise ) { var that = this ; this . _disposed = false ; this . element = element = element || _Global . document . createElement ( "div" ) ; _ElementUtilities . addClass ( element , "win-disposable" ) ; element . msSourceLocation = uri ; this . uri = uri ; this . selfhost = selfhost ( uri ) ; element . winControl = this ; _ElementUtilities . addClass ( element , "pagecontrol" ) ; var profilerMarkIdentifier = " uri='" + uri + "'" + _BaseUtils . _getProfilerMarkIdentifier ( this . element ) ; _WriteProfilerMark ( "WinJS.UI.Pages:createPage" + profilerMarkIdentifier + ",StartTM" ) ; var load = Promise . wrap ( ) . then ( function Pages_load ( ) { return that . load ( uri ) ; } ) ; var renderCalled = load . then ( function Pages_init ( loadResult ) { return Promise . join ( { loadResult : loadResult , initResult : that . init ( element , options ) } ) ; } ) . then ( function Pages_render ( result ) { return that . render ( element , options , result . loadResult ) ; } ) ; this . elementReady = renderCalled . then ( function ( ) { return element ; } ) ; this . renderComplete = renderCalled . then ( function Pages_process ( ) { return that . process ( element , options ) ; } ) . then ( function Pages_processed ( ) { return that . processed ( element , options ) ; } ) . then ( function ( ) { return that ; } ) ; var callComplete = function ( ) { complete && complete ( that ) ; _WriteProfilerMark ( "WinJS.UI.Pages:createPage" + profilerMarkIdentifier + ",StopTM" ) ; } ; // promises guarantee order, so this will be called prior to ready path below // this . renderComplete . then ( callComplete , callComplete ) ; this . readyComplete = this . renderComplete . then ( function ( ) { return parentedPromise ; } ) . then ( function Pages_ready ( ) { that . ready ( element , options ) ; return that ; } ) . then ( null , function Pages_error ( err ) { return that . error ( err ) ; } ) ; }
This needs to follow the WinJS.UI.processAll "async constructor" pattern to interop nicely in the "Views.Control" use case.
This needs to follow the WinJS . UI . processAll async constructor pattern to interop nicely in the Views . Control use case .