本文整理汇总了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);
}
示例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;
}
示例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' },
() => {}
);
示例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' },
() => {}
);