當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript objects.mixin函數代碼示例

本文整理匯總了TypeScript中vs/base/common/objects.mixin函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript mixin函數的具體用法?TypeScript mixin怎麽用?TypeScript mixin使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了mixin函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

	constructor(container: HTMLElement, configuration: _.ITreeConfiguration, options: _.ITreeOptions = {}) {
		super();

		this.toDispose = [];

		this._onDispose = new Emitter<void>();
		this._onHighlightChange = new Emitter<void>();

		this.toDispose.push(this._onDispose, this._onHighlightChange);

		this.container = container;
		this.configuration = configuration;
		this.options = options;
		mixin(this.options, defaultStyles, false);

		this.options.twistiePixels = typeof this.options.twistiePixels === 'number' ? this.options.twistiePixels : 32;
		this.options.showTwistie = this.options.showTwistie === false ? false : true;
		this.options.indentPixels = typeof this.options.indentPixels === 'number' ? this.options.indentPixels : 12;
		this.options.alwaysFocused = this.options.alwaysFocused === true ? true : false;
		this.options.useShadows = this.options.useShadows === false ? false : true;
		this.options.paddingOnRow = this.options.paddingOnRow === false ? false : true;

		this.context = new TreeContext(this, configuration, options);
		this.model = new Model.TreeModel(this.context);
		this.view = new View.TreeView(this.context, this.container);

		this.view.setModel(this.model);

		this.addEmitter(this.model);
		this.addEmitter(this.view);

		this.toDispose.push(this.model.addListener('highlight', () => this._onHighlightChange.fire()));
	}
開發者ID:hungys,項目名稱:vscode,代碼行數:33,代碼來源:treeImpl.ts

示例2: constructor

	constructor(opts: ICheckboxOpts) {
		super();
		this._opts = objects.clone(opts);
		objects.mixin(this._opts, defaultOpts, false);
		this._checked = this._opts.isChecked;

		this.domNode = document.createElement('div');
		this.domNode.title = this._opts.title;
		this.domNode.className = this._className();
		this.domNode.tabIndex = 0;
		this.domNode.setAttribute('role', 'checkbox');
		this.domNode.setAttribute('aria-checked', String(this._checked));
		this.domNode.setAttribute('aria-label', this._opts.title);

		this.applyStyles();

		this.onclick(this.domNode, (ev) => {
			this.checked = !this._checked;
			this._opts.onChange(false);
			ev.preventDefault();
		});

		this.onkeydown(this.domNode, (keyboardEvent) => {
			if (keyboardEvent.keyCode === KeyCode.Space || keyboardEvent.keyCode === KeyCode.Enter) {
				this.checked = !this._checked;
				this._opts.onChange(true);
				keyboardEvent.preventDefault();
				return;
			}

			if (this._opts.onKeyDown) {
				this._opts.onKeyDown(keyboardEvent);
			}
		});
	}
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:35,代碼來源:checkbox.ts

示例3: log

	public log(eventName: string, data?: any): void {
		if (!this._aiClient) {
			return;
		}
		data = mixin(data, this._defaultData);
		let {properties, measurements} = AIAdapter._getData(data);
		this._aiClient.trackEvent(this._eventPrefix + '/' + eventName, properties, measurements);
	}
開發者ID:Buildsoftwaresphere,項目名稱:vscode,代碼行數:8,代碼來源:aiAdapter.ts

示例4: constructor

	constructor(container: any, options?: IButtonOptions) {
		super();

		this.options = options || Object.create(null);
		mixin(this.options, defaultOptions, false);

		this.buttonBackground = this.options.buttonBackground;
		this.buttonHoverBackground = this.options.buttonHoverBackground;
		this.buttonForeground = this.options.buttonForeground;
		this.buttonBorder = this.options.buttonBorder;

		this.$el = $('a.monaco-button').attr({
			'tabIndex': '0',
			'role': 'button'
		}).appendTo(container);

		this.$el.on(DOM.EventType.CLICK, (e) => {
			if (!this.enabled) {
				DOM.EventHelper.stop(e);
				return;
			}

			this.emit(DOM.EventType.CLICK, e);
		});

		this.$el.on(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
			let event = new StandardKeyboardEvent(e);
			let eventHandled = false;
			if (this.enabled && event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
				this.emit(DOM.EventType.CLICK, e);
				eventHandled = true;
			} else if (event.equals(KeyCode.Escape)) {
				this.$el.domBlur();
				eventHandled = true;
			}

			if (eventHandled) {
				DOM.EventHelper.stop(event, true);
			}
		});

		this.$el.on(DOM.EventType.MOUSE_OVER, (e: MouseEvent) => {
			if (!this.$el.hasClass('disabled')) {
				const hoverBackground = this.buttonHoverBackground ? this.buttonHoverBackground.toString() : null;
				if (hoverBackground) {
					this.$el.style('background-color', hoverBackground);
				}
			}
		});

		this.$el.on(DOM.EventType.MOUSE_OUT, (e: MouseEvent) => {
			this.applyStyles(); // restore standard styles
		});

		this.applyStyles();
	}
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:56,代碼來源:button.ts

示例5: constructor

	constructor(container: HTMLElement, options?: IProgressBarOptions) {
		this.options = options || Object.create(null);
		mixin(this.options, defaultOpts, false);

		this.toUnbind = [];
		this.workedVal = 0;

		this.progressBarBackground = this.options.progressBarBackground;

		this.create(container);
	}
開發者ID:jumpinjackie,項目名稱:sqlopsstudio,代碼行數:11,代碼來源:progressbar.ts

示例6: fork

function fork(id: string): cp.ChildProcess {
	const opts: any = {
		env: objects.mixin(objects.deepClone(process.env), {
			AMD_ENTRYPOINT: id,
			PIPE_LOGGING: 'true',
			VERBOSE_LOGGING: true
		})
	};

	return cp.fork(getPathFromAmdModule(require, 'bootstrap-fork'), ['--type=processTests'], opts);
}
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:11,代碼來源:processes.test.ts

示例7: fork

function fork(id: string): cp.ChildProcess {
	const opts: any = {
		env: objects.mixin(objects.clone(process.env), {
			AMD_ENTRYPOINT: id,
			PIPE_LOGGING: 'true',
			VERBOSE_LOGGING: true
		})
	};

	return cp.fork(URI.parse(require.toUrl('bootstrap')).fsPath, ['--type=processTests'], opts);
}
開發者ID:m-khosravi,項目名稱:vscode,代碼行數:11,代碼來源:processes.test.ts

示例8: constructor

	constructor(container: HTMLElement, options?: ICountBadgeOptions) {
		this.options = options || Object.create(null);
		mixin(this.options, defaultOpts, false);

		this.badgeBackground = this.options.badgeBackground;
		this.badgeForeground = this.options.badgeForeground;
		this.badgeBorder = this.options.badgeBorder;

		this.element = append(container, $('.monaco-count-badge'));
		this.titleFormat = this.options.titleFormat || '';
		this.setCount(this.options.count || 0);
	}
開發者ID:hungys,項目名稱:vscode,代碼行數:12,代碼來源:countBadge.ts

示例9: test

	test('mixin - array', function () {

		let foo: any = {};
		objects.mixin(foo, { bar: [1, 2, 3] });

		assert(foo.bar);
		assert(Array.isArray(foo.bar));
		assert.equal(foo.bar.length, 3);
		assert.equal(foo.bar[0], 1);
		assert.equal(foo.bar[1], 2);
		assert.equal(foo.bar[2], 3);
	});
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:12,代碼來源:objects.test.ts


注:本文中的vs/base/common/objects.mixin函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。