本文整理匯總了TypeScript中dojo/promise/all.all函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript all函數的具體用法?TypeScript all怎麽用?TypeScript all使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了all函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
query: function (query, options) {
var results = all([
this.refreshResources(query),
this.refreshAccountPermissions(query)
]).then(lang.hitch(this, function (response) {
var accountPermissions = {};
arrayUtil.forEach(response[1], function (item, idx) {
accountPermissions[item.PermissionName] = item;
}, this);
var data = [];
arrayUtil.forEach(response[0], function (item, idx) {
var accountPermission = accountPermissions[item.name];
data.push(lang.mixin(item, {
__hpcc_type: "Resources",
__hpcc_id: this.parentRow.__hpcc_id + CONCAT_SYMBOL + item.name,
__hpcc_parent: this.parentRow,
DisplayName: item.description ? item.description : item.name,
AccountName: this.groupname,
allow_access: accountPermission ? accountPermission.allow_access : false,
allow_read: accountPermission ? accountPermission.allow_read : false,
allow_write: accountPermission ? accountPermission.allow_write : false,
allow_full: accountPermission ? accountPermission.allow_full : false,
deny_access: accountPermission ? accountPermission.deny_access : false,
deny_read: accountPermission ? accountPermission.deny_read : false,
deny_write: accountPermission ? accountPermission.deny_write : false,
deny_full: accountPermission ? accountPermission.deny_full : false
}));
}, this);
options = options || {};
this.setData(SimpleQueryEngine({}, { sort: options.sort })(data));
return this.data;
}));
return QueryResults(results);
},
示例2: function
this.fetchResults(function (results) {
var resultContents = [];
arrayUtil.forEach(resultNames, function (item, idx) {
resultContents.push(context.namedResults[item].fetchContent(row, count));
});
all(resultContents).then(function (resultContents) {
var results = [];
arrayUtil.forEach(resultContents, function (item, idx) {
results[resultNames[idx]] = item;
});
deferred.resolve(results);
});
});
示例3: WUQuerysetAliasAction
export function WUQuerysetAliasAction(selection, action) {
var requests = [];
arrayUtil.forEach(selection, function (item, idx) {
var request = {
QuerySetName: item.QuerySetId,
Action: action,
"Aliases.QuerySetAliasActionItem.0.Name": item.Name,
"Aliases.QuerySetAliasActionItem.itemcount": 1
};
requests.push(ESPRequest.send("WsWorkunits", "WUQuerysetAliasAction", {
request: request
}));
});
return all(requests);
}
示例4: WUQuerysetQueryAction
export function WUQuerysetQueryAction(selection, action) {
if (action === "Deactivate") {
return this.WUQuerysetAliasAction(selection, action);
}
var requests = [];
arrayUtil.forEach(selection, function (item, idx) {
var request = {
QuerySetName: item.QuerySetId,
Action: action,
"Queries.QuerySetQueryActionItem.0.QueryId": item.Id,
"Queries.QuerySetQueryActionItem.itemcount": 1
};
requests.push(ESPRequest.send("WsWorkunits", "WUQuerysetQueryAction", {
request: request
}));
});
return all(requests);
}
示例5: function
refresh: function (callback) {
this.clear();
this.rootItem = createTreeItem(TopologyRoot, "root");
var context = this;
return all({
targetClusterQuery: WsTopology.TpTargetClusterQuery({
request: {
Type: "ROOT"
}
}).then(function (response) {
var clusterTypes = {};
var retVal = [];
if (lang.exists("TpTargetClusterQueryResponse.TpTargetClusters", response)) {
arrayUtil.forEach(response.TpTargetClusterQueryResponse.TpTargetClusters.TpTargetCluster, function (item, idx) {
if (!clusterTypes[item.Type]) {
clusterTypes[item.Type] = createTreeItem(TargetClusterType, item.Type, context.rootItem, { Name: item.Type })
retVal.push(clusterTypes[item.Type]);
}
clusterTypes[item.Type].appendChild(createTreeItem(TargetCluster, item.Name, context.rootItem, item));
}, this);
}
return retVal;
}),
serviceQuery: WsTopology.TpServiceQuery({
request: {
Type: "ALLSERVICES"
}
}).then(function (response) {
var retVal = [];
if (lang.exists("TpServiceQueryResponse.ServiceList", response)) {
retVal.push(createTreeItem(Services, "Services", context.rootItem, response.TpServiceQueryResponse.ServiceList));
}
return retVal;
})
}).then(function (responses) {
context.rootItem.appendChildren(responses.targetClusterQuery);
context.rootItem.appendChildren(responses.serviceQuery);
callback();
});
}
示例6: function
'custom Content-Type': function () {
var def = this.async(),
expectedContentType = 'application/x-test-xhr';
function post(headers) {
return xhr.post('/__services/request/xhr', {
query: {
'header-test': 'true'
},
headers: headers,
data: 'testing',
handleAs: 'json'
});
}
all({
lowercase: post({
'content-type': expectedContentType
}),
uppercase: post({
'CONTENT-TYPE': expectedContentType
})
}).then(
def.callback(function (results) {
assert.match(
results.lowercase.headers['content-type'],
/^application\/x-test-xhr(?:;.*)?$/
);
assert.match(
results.uppercase.headers['content-type'],
/^application\/x-test-xhr(?:;.*)?$/
);
}),
def.reject
);
},