本文整理汇总了TypeScript中@ember/application/deprecations.deprecate函数的典型用法代码示例。如果您正苦于以下问题:TypeScript deprecate函数的具体用法?TypeScript deprecate怎么用?TypeScript deprecate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deprecate函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: selector
/**
@private
@param {string} [selector] the selector to search for relative to element
@returns {jQuery} a jQuery object representing the selector (or element itself if no selector)
*/
function jQuerySelector(selector: string): any {
deprecate(
'Using this.$() in a rendering test has been deprecated, consider using this.element instead.',
false,
{
id: 'ember-test-helpers.rendering-context.jquery-element',
until: '2.0.0',
// @ts-ignore
url: 'https://emberjs.com/deprecations/v3.x#toc_jquery-apis',
}
);
let { element } = getContext() as RenderingTestContext;
// emulates Ember internal behavor of `this.$` in a component
// https://github.com/emberjs/ember.js/blob/v2.5.1/packages/ember-views/lib/views/states/has_element.js#L18
return selector ? global.jQuery(selector, element) : global.jQuery(element);
}
开发者ID:switchfly,项目名称:ember-test-helpers,代码行数:23,代码来源:setup-rendering-context.ts
示例2: buildFileEvent
// eslint-disable-next-line require-jsdoc
function buildFileEvent(
type: FileSelectionEventType,
element: HTMLInputElement,
options: any = {}
): Event {
let event = buildBasicEvent(type);
let files;
if (Array.isArray(options)) {
deprecate(
'Passing the `options` param as an array to `triggerEvent` for file inputs is deprecated. Please pass an object with a key `files` containing the array instead.',
false,
{
id: 'ember-test-helpers.trigger-event.options-blob-array',
until: '2.0.0',
}
);
files = options;
} else {
files = options.files;
}
if (files.length > 0) {
Object.defineProperty(files, 'item', {
value(index: number) {
return typeof index === 'number' ? this[index] : null;
},
});
Object.defineProperty(element, 'files', {
value: files,
configurable: true,
});
}
Object.defineProperty(event, 'target', {
value: element,
});
return event;
}
开发者ID:switchfly,项目名称:ember-test-helpers,代码行数:41,代码来源:fire-event.ts
示例3: deprecate
import { deprecate, deprecateFunc } from '@ember/application/deprecations';
deprecate('this is no longer advised', false, {
id: 'no-longer-advised',
until: 'v4.0'
});
deprecate('this is no longer advised', false);
deprecateFunc('this is no longer advised', () => {});
deprecateFunc(
'this is no longer advised',
{ id: 'no-longer-do-this', until: 'v4.0' },
() => {}
);
开发者ID:worr,项目名称:DefinitelyTyped,代码行数:14,代码来源:deprecations.ts
示例4: deprecate
import { deprecate, deprecateFunc } from '@ember/application/deprecations';
deprecate('this is no longer advised', false, {
id: 'no-longer-advised',
until: 'v4.0'
});
deprecate('this is no longer advised', false, {
id: 'no-longer-advised',
until: 'v4.0',
url: 'https://emberjs.com'
});
deprecate('this is no longer advised', false); // $ExpectError
deprecateFunc('this is no longer advised', () => {}); // $ExpectError
deprecateFunc(
'this is no longer advised',
{ id: 'no-longer-do-this', until: 'v4.0' },
() => {}
);
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:19,代码来源:deprecations.ts
注:本文中的@ember/application/deprecations.deprecate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论