本文整理匯總了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';
},