本文整理匯總了TypeScript中dojo/_base/Deferred.resolve函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript resolve函數的具體用法?TypeScript resolve怎麽用?TypeScript resolve使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了resolve函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
query: function (query, options) {
var deferredResults = new Deferred();
deferredResults.total = new Deferred();
function nextItem(itemParts) {
var part = "";
while (itemParts.length && part.trim() === "") {
part = itemParts[0]; itemParts.shift();
}
return part;
}
if (!query.Name) {
deferredResults.resolve([]);
deferredResults.total.resolve(0);
} else {
TpLogFile({
request: lang.mixin({}, query, {
PageNumber: options.start / options.count
})
}).then(lang.hitch(this, function (response) {
var data = [];
if (lang.exists("TpLogFileResponse.LogData", response)) {
this.lastPage = response.TpLogFileResponse.LogData;
this.emit("pageLoaded", this.lastPage);
arrayUtil.forEach(response.TpLogFileResponse.LogData.split("\n"), function (item, idx) {
if (options.start === 0 || idx > 0) {
// Throw away first line as it will probably only be a partial line ---
var itemParts = item.split(" ");
var lineNo, date, time, pid, tid, details;
if (itemParts.length) lineNo = nextItem(itemParts);
if (itemParts.length) date = nextItem(itemParts);
if (itemParts.length) time = nextItem(itemParts);
if (itemParts.length) pid = nextItem(itemParts);
if (itemParts.length) tid = nextItem(itemParts);
if (itemParts.length) details = itemParts.join(" ");
data.push({
__hpcc_id: response.TpLogFileResponse.PageNumber + "_" + idx,
lineNo: lineNo,
date: date,
time: time,
pid: pid,
tid: tid,
details: details
});
}
}, this);
}
this.setData(data);
if (lang.exists("TpLogFileResponse.TotalPages", response)) {
deferredResults.total.resolve(response.TpLogFileResponse.TotalPages * options.count);
} else {
deferredResults.total.resolve(data.length);
}
return deferredResults.resolve(this.data);
}));
}
return QueryResults(deferredResults);
}
示例2: function
}).then(function (response) {
if (context.preProcessFullResponse) {
context.preProcessFullResponse(response, request, query, options);
}
var items = [];
if (context._hasResponseContent(response)) {
if (context.preProcessResponse) {
var responseQualiferArray = context.responseQualifier.split(".");
context.preProcessResponse(lang.getObject(responseQualiferArray[0], false, response), request, query, options);
}
arrayUtil.forEach(context._getResponseContent(response), function (item, index) {
if (context.preProcessRow) {
context.preProcessRow(item, request, query, options);
}
var storeItem = context.get(context.getIdentity(item), item);
context.update(context.getIdentity(item), item);
items.push(storeItem);
});
}
if (context.postProcessResults) {
context.postProcessResults(items);
}
if (context.responseTotalQualifier) {
deferredResults.total.resolve(lang.getObject(context.responseTotalQualifier, false, response));
} else if (context._hasResponseContent(response)) {
deferredResults.total.resolve(items.length);
} else {
deferredResults.total.resolve(0);
}
deferredResults.resolve(items);
return response;
});
示例3: GetVisualisations
export function GetVisualisations() {
var deferred = new Deferred();
if (this.visualisations) {
deferred.resolve(this.visualisations);
}
return deferred.promise;
}
示例4: function
}).then(lang.hitch(this, function (response) {
var data = [];
if (lang.exists("DFUSpaceResponse.DFUSpaceItems.DFUSpaceItem", response)) {
arrayUtil.forEach(response.DFUSpaceResponse.DFUSpaceItems.DFUSpaceItem, function (item, idx) {
data.push(lang.mixin(item, {
__hpcc_id: item.Name
}));
}, this);
}
if (options.sort && options.sort.length) {
data.sort(function (_l, _r) {
var l = _l[options.sort[0].attribute];
var r = _r[options.sort[0].attribute];
if (l === r) {
return 0;
}
switch (options.sort[0].attribute) {
case "TotalSize":
case "LargestSize":
case "SmallestSize":
case "NumOfFiles":
case "NumOfFilesUnknown":
l = parseInt(l.split(",").join(""));
r = parseInt(r.split(",").join(""));
}
if (options.sort[0].descending) {
return r < l ? -1 : 1;
}
return l < r ? -1 : 1;
})
}
this.setData(data);
deferredResults.resolve(data);
deferredResults.total.resolve(data.length);
}));
示例5: all
all(resultContents).then(function (resultContents) {
var results = [];
arrayUtil.forEach(resultContents, function (item, idx) {
results[resultNames[idx]] = item;
});
deferred.resolve(results);
});
示例6: function
submit: function (target) {
this._assertHasWuid();
var context = this;
var deferred = new Deferred()
deferred.promise.then(function (target) {
WsWorkunits.WUSubmit({
request: {
Wuid: context.Wuid,
Cluster: target
},
load: function (response) {
context.onSubmit();
}
});
});
if (target) {
deferred.resolve(target);
} else {
WsTopology.TpLogicalClusterQuery().then(function (response) {
if (lang.exists("TpLogicalClusterQueryResponse.default", response)) {
deferred.resolve(response.TpLogicalClusterQueryResponse["default"].Name);
}
});
}
},
示例7: GetWsEclIFrameURL
export function GetWsEclIFrameURL(type) {
var deferred = new Deferred();
if (this.WsEclIFrameURL === "") {
var context = this;
this.GetESPServiceBaseURL("ws_ecl").then(function (response) {
context.WsEclIFrameURL = response + dojoConfig.urlInfo.basePath + "/stub.htm?Widget=IFrameWidget&src=" + encodeURIComponent("/WsEcl/");
deferred.resolve(context.WsEclIFrameURL + encodeURIComponent(type + "/query/"));
});
} else {
deferred.resolve(this.WsEclIFrameURL + encodeURIComponent(type + "/query/"));
}
return deferred.promise;
}
示例8: GetWsEclURL
export function GetWsEclURL(type) {
var deferred = new Deferred();
if (this.WsEclURL === "") {
var context = this;
this.GetESPServiceBaseURL("ws_ecl").then(function (response) {
context.WsEclURL = response + "/WsEcl/";
deferred.resolve(context.WsEclURL + type + "/query/");
});
} else {
deferred.resolve(this.WsEclURL + type + "/query/");
}
return deferred.promise;
}
示例9: Permissions
Permissions().then(lang.hitch(this, function (response) {
var data = [];
if (lang.exists("BasednsResponse.Basedns.Basedn", response)) {
arrayUtil.forEach(response.BasednsResponse.Basedns.Basedn, function (item, idx) {
data.push(lang.mixin(item, {
__hpcc_type: "Permission",
__hpcc_id: item.basedn,
DisplayName: item.name,
children: lang.mixin(CreateResourcesStore(this.groupname, this.username, item.basedn), {
parent: this,
parentRow: item
})
}));
}, this);
}
options = options || {};
this.setData(SimpleQueryEngine({}, { sort: options.sort })(data));
deferredResults.resolve(this.data);
deferredResults.total.resolve(this.data.length);
}));
示例10: function
SubmitXML: function (xml) {
var deferred = new Deferred();
if (this.queries[xml]) {
deferred.resolve(this.queries[xml]);
} else {
var domXml = parser.parse(xml);
var query = {};
arrayUtil.forEach(domXml.firstChild.childNodes, function (item, idx) {
if (item.tagName) {
query[item.tagName] = item.textContent;
}
});
var context = this;
WsEcl.Submit(this.QuerySetId, this.Id, query).then(function (response) {
context.queries[xml] = response;
deferred.resolve(response);
return response;
});
}
return deferred.promise;
},