本文整理匯總了TypeScript中@dojo/shim/support/has.add函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript add函數的具體用法?TypeScript add怎麽用?TypeScript add使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了add函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: add
import global from '@dojo/shim/global';
import has, { add } from '@dojo/shim/support/has';
export * from '@dojo/shim/support/has';
export default has;
add('object-assign', typeof global.Object.assign === 'function', true);
add('arraybuffer', typeof global.ArrayBuffer !== 'undefined', true);
add('formdata', typeof global.FormData !== 'undefined', true);
add('filereader', typeof global.FileReader !== 'undefined', true);
add('xhr', typeof global.XMLHttpRequest !== 'undefined', true);
add('xhr2', has('xhr') && 'responseType' in global.XMLHttpRequest.prototype, true);
add('blob', function () {
if (!has('xhr2')) {
return false;
}
const request = new global.XMLHttpRequest();
request.open('GET', 'http://www.google.com', true);
request.responseType = 'blob';
request.abort();
return request.responseType === 'blob';
}, true);
add('node-buffer', 'Buffer' in global && typeof global.Buffer === 'function', true);
add('fetch', 'fetch' in global && typeof global.fetch === 'function', true);
add('web-worker-xhr-upload', new Promise((resolve) => {
try {
示例2: add
import global from './global';
import has, { add } from '@dojo/shim/support/has';
export * from '@dojo/shim/support/has';
export default has;
add('object-assign', typeof global.Object.assign === 'function');
add('arraybuffer', typeof global.ArrayBuffer !== 'undefined');
add('formdata', typeof global.FormData !== 'undefined');
add('filereader', typeof global.FileReader !== 'undefined', true);
add('xhr', typeof global.XMLHttpRequest !== 'undefined');
add('xhr2', has('xhr') && 'responseType' in global.XMLHttpRequest.prototype);
add('blob', function () {
if (!has('xhr2')) {
return false;
}
const request = new XMLHttpRequest();
request.open('GET', '/', true);
request.responseType = 'blob';
request.abort();
return request.responseType === 'blob';
});
add('node-buffer', 'Buffer' in global && typeof global.Buffer === 'function');
add('fetch', 'fetch' in global && typeof global.fetch === 'function');