本文整理汇总了TypeScript中@dojo/shim/support/has.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: has
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: function
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);
示例3: function
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';
});
示例4:
function() {
if (!has('xhr2')) {
return false;
}
const request = new global.XMLHttpRequest();
request.open('GET', global.location.protocol + '//www.google.com', true);
request.responseType = 'blob';
request.abort();
return request.responseType === 'blob';
},