本文整理汇总了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;未经允许,请勿转载。 |
请发表评论