本文整理汇总了TypeScript中dojo/_base/lang.hitch函数的典型用法代码示例。如果您正苦于以下问题:TypeScript hitch函数的具体用法?TypeScript hitch怎么用?TypeScript hitch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hitch函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
query: function (query, options) {
var deferredResults = new Deferred();
deferredResults.total = new Deferred();
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);
}));
return QueryResults(deferredResults);
}
示例2: 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);
}
示例3: function
setContent: function (message, cssClass, sticky) {
// summary:
// description
// the message and it's css class
console.log('app.Toaster:setContent', arguments);
if (message) {
if (this.isDuplicate(this.toasterItems, message, cssClass)) {
return;
}
var item:ToasterItemType = new ToasterItem({
message: message,
cssClass: cssClass,
sticky: sticky
}).placeAt(this.domNode, 'first');
if (this.toasterItems.length >= this.maxItems) {
var entry = this.toasterItems[0];
entry.destroyRecursive(false);
}
this.toasterItems.push(item);
item.show();
var connection;
connection = aspect.before(item, 'destroyRecursive', lang.hitch(this, function () {
this.toasterItems = this.toasterItems.slice(1);
connection.remove();
}));
}
},
示例4: function
query: function (query, options) {
switch (query.CountBy) {
case "Year":
case "Quarter":
case "Month":
case "Day":
query.Interval = query.CountBy;
query.CountBy = "Date";
break;
}
var deferredResults = new Deferred();
deferredResults.total = new Deferred();
DFUSpace({
request: query
}).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);
}));
return QueryResults(deferredResults);
}