MCPcopy
hub / github.com/winjs/winjs / constructor

Method constructor

src/js/WinJS/Controls/SplitView/_SplitView.ts:266–350  ·  view source on GitHub ↗
(element?: HTMLElement, options: any = {})

Source from the content-addressed store, hash-verified

264 private _updateTabIndicesThrottled: Function;
265
266 constructor(element?: HTMLElement, options: any = {}) {
267 /// <signature helpKeyword="WinJS.UI.SplitView.SplitView">
268 /// <summary locid="WinJS.UI.SplitView.constructor">
269 /// Creates a new SplitView control.
270 /// </summary>
271 /// <param name="element" type="HTMLElement" domElement="true" isOptional="true" locid="WinJS.UI.SplitView.constructor_p:element">
272 /// The DOM element that hosts the SplitView control.
273 /// </param>
274 /// <param name="options" type="Object" isOptional="true" locid="WinJS.UI.SplitView.constructor_p:options">
275 /// An object that contains one or more property/value pairs to apply to the new control.
276 /// Each property of the options object corresponds to one of the control's properties or events.
277 /// Event names must begin with "on". For example, to provide a handler for the beforeclose event,
278 /// add a property named "onbeforeclose" to the options object and set its value to the event handler.
279 /// </param>
280 /// <returns type="WinJS.UI.SplitView" locid="WinJS.UI.SplitView.constructor_returnValue">
281 /// The new SplitView.
282 /// </returns>
283 /// </signature>
284
285 // Check to make sure we weren't duplicated
286 if (element && element["winControl"]) {
287 throw new _ErrorFromName("WinJS.UI.SplitView.DuplicateConstruction", Strings.duplicateConstruction);
288 }
289
290 this._initializeDom(element || _Global.document.createElement("div"));
291 this._machine = new _OpenCloseMachine.OpenCloseMachine({
292 eventElement: this._dom.root,
293 onOpen: () => {
294 this._cachedHiddenPaneThickness = null;
295 var hiddenPaneThickness = this._getHiddenPaneThickness();
296
297 this._isOpenedMode = true;
298 this._updateDomImpl();
299
300 _ElementUtilities.addClass(this._dom.root, ClassNames._animating);
301 return this._playShowAnimation(hiddenPaneThickness).then(() => {
302 _ElementUtilities.removeClass(this._dom.root, ClassNames._animating);
303 });
304 },
305 onClose: () => {
306 _ElementUtilities.addClass(this._dom.root, ClassNames._animating);
307 return this._playHideAnimation(this._getHiddenPaneThickness()).then(() => {
308 _ElementUtilities.removeClass(this._dom.root, ClassNames._animating);
309 this._isOpenedMode = false;
310 this._updateDomImpl();
311 });
312 },
313 onUpdateDom: () => {
314 this._updateDomImpl();
315 },
316 onUpdateDomWithIsOpened: (isOpened: boolean) => {
317 this._isOpenedMode = isOpened;
318 this._updateDomImpl();
319 }
320 });
321
322 // Initialize private state.
323 this._disposed = false;

Callers

nothing calls this directly

Calls 13

_initializeDomMethod · 0.95
_updateDomImplMethod · 0.95
_playShowAnimationMethod · 0.95
_playHideAnimationMethod · 0.95
closePaneMethod · 0.95
_updateTabIndicesMethod · 0.95
createElementMethod · 0.80
restoreFocusMethod · 0.80
exitInitMethod · 0.80
addClassMethod · 0.65
thenMethod · 0.65

Tested by

no test coverage detected