当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Deferred.resolve函数代码示例

本文整理汇总了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);
    }
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:60,代码来源:WsTopology.ts

示例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;
 });
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:32,代码来源:ESPRequest.ts

示例3: GetVisualisations

export function GetVisualisations() {
    var deferred = new Deferred();
    if (this.visualisations) {
        deferred.resolve(this.visualisations);
    }
    return deferred.promise;
}
开发者ID:GordonSmith,项目名称:HPCC-Platform,代码行数:7,代码来源:WsWorkunits.ts

示例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);
 }));
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:35,代码来源:WsDfu.ts

示例5: all

 all(resultContents).then(function (resultContents) {
     var results = [];
     arrayUtil.forEach(resultContents, function (item, idx) {
         results[resultNames[idx]] = item;
     });
     deferred.resolve(results);
 });
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:7,代码来源:ESPWorkunit.ts

示例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);
                }
            });
        }
    },
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:26,代码来源:ESPWorkunit.ts

示例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;
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:13,代码来源:WsTopology.ts

示例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;
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:13,代码来源:WsTopology.ts

示例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);
 }));
开发者ID:GordonSmith,项目名称:HPCC-Platform,代码行数:20,代码来源:ws_access.ts

示例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;
 },
开发者ID:richardkchapman,项目名称:HPCC-Platform,代码行数:21,代码来源:ESPQuery.ts


注:本文中的dojo/_base/Deferred.resolve函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。