(uri, members)
| 158 | }; |
| 159 | |
| 160 | function Pages_define(uri, members) { |
| 161 | /// <signature helpKeyword="WinJS.UI.Pages.define"> |
| 162 | /// <summary locid="WinJS.UI.Pages.define"> |
| 163 | /// Creates a new page control from the specified URI that contains the specified members. |
| 164 | /// Multiple calls to this method for the same URI are allowed, and all members will be |
| 165 | /// merged. |
| 166 | /// </summary> |
| 167 | /// <param name="uri" locid="WinJS.UI.Pages.define_p:uri"> |
| 168 | /// The URI for the content that defines the page. |
| 169 | /// </param> |
| 170 | /// <param name="members" locid="WinJS.UI.Pages.define_p:members"> |
| 171 | /// Additional members that the control will have. |
| 172 | /// </param> |
| 173 | /// <returns type="Function" locid="WinJS.UI.Pages.define_returnValue"> |
| 174 | /// A constructor function that creates the page. |
| 175 | /// </returns> |
| 176 | /// </signature> |
| 177 | |
| 178 | var base = get(uri); |
| 179 | uri = abs(uri); |
| 180 | |
| 181 | if (!base) { |
| 182 | base = _Base.Class.define( |
| 183 | // This needs to follow the WinJS.UI.processAll "async constructor" |
| 184 | // pattern to interop nicely in the "Views.Control" use case. |
| 185 | // |
| 186 | function PageControl_ctor(element, options, complete, parentedPromise) { |
| 187 | var that = this; |
| 188 | this._disposed = false; |
| 189 | this.element = element = element || _Global.document.createElement("div"); |
| 190 | _ElementUtilities.addClass(element, "win-disposable"); |
| 191 | element.msSourceLocation = uri; |
| 192 | this.uri = uri; |
| 193 | this.selfhost = selfhost(uri); |
| 194 | element.winControl = this; |
| 195 | _ElementUtilities.addClass(element, "pagecontrol"); |
| 196 | |
| 197 | var profilerMarkIdentifier = " uri='" + uri + "'" + _BaseUtils._getProfilerMarkIdentifier(this.element); |
| 198 | |
| 199 | _WriteProfilerMark("WinJS.UI.Pages:createPage" + profilerMarkIdentifier + ",StartTM"); |
| 200 | |
| 201 | var load = Promise.wrap(). |
| 202 | then(function Pages_load() { return that.load(uri); }); |
| 203 | |
| 204 | var renderCalled = load.then(function Pages_init(loadResult) { |
| 205 | return Promise.join({ |
| 206 | loadResult: loadResult, |
| 207 | initResult: that.init(element, options) |
| 208 | }); |
| 209 | }).then(function Pages_render(result) { |
| 210 | return that.render(element, options, result.loadResult); |
| 211 | }); |
| 212 | |
| 213 | this.elementReady = renderCalled.then(function () { return element; }); |
| 214 | |
| 215 | this.renderComplete = renderCalled. |
| 216 | then(function Pages_process() { |
| 217 | return that.process(element, options); |
nothing calls this directly
no test coverage detected