• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript jQuery.get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中jQuery.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: loadData

export function loadData(callback: CallbackFnType){
  // start data get
  $.get("http://localhost:8080/events/", function(dataString){
    let data: any = JSON.parse(dataString);
    // store individual value keys and their x steps
    let chartData: EventData = {};
    let xs: EventXs = {};
    // iterate over each event
    data.map((row) => {
      let step = row.step;
      // iterate over each event in values
      _.forOwn(row.values, (value: number, key: string) => {
        // if new type of event, create new obj for key
        if (!_.has(chartData, key)){
          chartData[key] = [key];
          chartData[key + '_x'] = [key + '_x'];
          xs[key] = key + '_x';
        }
        chartData[key].push(value);
        chartData[key + '_x'].push(step);
      });
    });
    callback(xs, chartData);
  });
}
开发者ID:Islandman93,项目名称:NeuralNetLog,代码行数:25,代码来源:Events.ts


示例2: loadData

export function loadData(callback: CallbackFnType) {
  // start data get
  $.get("http://localhost:8080/stats/", function(dataString) {
    let data: PythonData[] = JSON.parse(dataString);
    // store individual value keys and their x steps
    let chartData: EventData = {};
    let xs: EventXs = {};
    // iterate over each event
    data.map((row) => {
      let step = row.step;
      // iterate over each stat in values
      row.values.map((value) => {
        let key = value.layerName + '_' + value.statName;

        // if new stat, create new obj for key
        if (!_.has(chartData, key)) {
          chartData[key] = [key];
          chartData[key + '_x'] = [key + '_x'];
          xs[key] = key + '_x';
        }
        chartData[key].push(value.value);
        chartData[key + '_x'].push(step);
      });
    });
    callback(xs, chartData);
  });
}
开发者ID:Islandman93,项目名称:NeuralNetLog,代码行数:27,代码来源:Stats.ts


示例3: getPoint2D

 public getPoint2D(addressSeach: string, callbackFn: (error: Error, point2D: Point2D) => void) {
     try {
         $.get(this.nominatimUrl + "/search?format=json&q=" + addressSeach, {
             timeout: 5000
         }, function(error: Error, result: any) {
             if (error)
                 callbackFn(error, undefined);
             else {
                 if (result.data instanceof Array && result.data.length > 0) {
                     var res = result.data[0];
                     var point2D: Point2D = new Point2D();
                     point2D.x = res.lon;
                     point2D.y = res.lat;
                     callbackFn(undefined, point2D);
                 } else {
                     console.error("result from nominatim : ", result);
                     callbackFn(new Error("Could not find address in nominatim!" + result), undefined);
                 }
             }
         });
     } catch (e) {
         console.error("the raw error from the nominatim service : ", e);
         if (e.code === "ENOTFOUND" || e.code === "ENETUNREACH" || e.code === "ECONNREFUSED" || e.code === "ESOCKETTIMEDOUT") {
             callbackFn(new Error("Could not contact geocoder (nominatim) service (" + this.nominatimUrl + ")."), undefined);
         }
         else
             callbackFn(new Error("Error while finding address!" + e), undefined);
     };
 }
开发者ID:smallstack,项目名称:location-services,代码行数:29,代码来源:NominatimGeocodingService.ts


示例4: getSortedCheckpoints

export function getSortedCheckpoints(callback: (checkpoints: Checkpoint[]) => void){
  // start data get
  $.get("http://localhost:8080/checkpoints", function(jsonStr: string){
    let checkpointList: Checkpoint[] = JSON.parse(jsonStr);
    callback(checkpointList.sort(checkpointCmp));
  });
}
开发者ID:Islandman93,项目名称:NeuralNetLog,代码行数:7,代码来源:Checkpoints.ts


示例5: getBlogInfo

 public getBlogInfo() {
     let url = this.makeUrl('/info');
     return $.get({
         url,
         dataType: 'jsonp'
     });
 }
开发者ID:b1o,项目名称:b1o.github.io,代码行数:7,代码来源:tumblrApi.service.ts


示例6: initKeggPathwayList

 /** 
  * Initialize the list of KEGG Pathways using Typeahead for autocomplete.
  * @param $input {JQuery} input field to initialize typeahead
  * @param onSelect {(event, obj) => any} function to call when a typeahead
  *  selection is made
  * @param cd {(diseaseObjs) => any} callback function
  * @returns {void} 
  */
 function initKeggPathwayList($input: JQuery, onSelect: (event, obj) => any,
   cb: (keggObjs) => any): void 
 {
   $.get(root_path + 'api/v1/list/kegg_pathways')
     .done((keggObjs) => {
       let bloodhound = new Bloodhound({
             datumTokenizer: (datum) => { return [datum.label]; },
             queryTokenizer: Bloodhound.tokenizers.whitespace,
             local: () => { return keggObjs; },
             identify: (obj) => { return obj['@id']; },
           });
       $input
         .typeahead('destroy')
         .typeahead({
           hint: true,
           highlight: true,
           minLength: 1
         }, {
             name: 'kegg-pathways-list',
             display: 'label',
             source: bloodhound
           })
         .attr('placeholder', 'Search for a Kegg Pathway')
         .off('typeahead:select')
         .on('typeahead:select', onSelect);
       cb(keggObjs);
     })
     .fail((error) => {
       let e = new Error(error.statusText);
       e.name = error.status;
       errorHandler(e, 'critical', false); 
     });
 }
开发者ID:delosh653,项目名称:SemNExT-Visualizations,代码行数:41,代码来源:ui.ts


示例7: pollPokemonOneHost

  private pollPokemonOneHost(): void {
    //console.log('pollPokemonOneHost');

    var url = "http://" + this.properties.pokedatahosturl + "/api/values/get";
    console.log(url);
    var webPart = this;

    $.get(url, function( data ) {

      if(webPart.layer != null)
      {
        webPart.map.removeLayer(webPart.layer);
      }

      var jsonObject = JSON.parse(data);

      webPart.layer = L.geoJson(jsonObject,
                                {
                                  style: RecordpointWebPart.setFeatureStyle
                                }).addTo(webPart.map);

    });
    setTimeout(() => {
          this.pollPokemonOneHost();
      }, this.properties.pokedatahostpolltime * 1000);
  };
开发者ID:SimonParkinsonBates,项目名称:spdevkit,代码行数:26,代码来源:RecordpointWebPart.ts


示例8: getAddress

    public getAddress(point: Point2D, callbackFn: (error: Error, address: Address) => void): void {

        try {
            $.get(this.nominatimUrl + "/reverse?format=json&lon=" + point.y + "&lat=" + point.x, {
                timeout: 5000
            }, function(error: Error, result: any) {
                if (error)
                    callbackFn(error, undefined);
                else {
                    if (result.data) {
                        var res = result.data;
                        var address: Address = new Address();
                        address.city = res["address"]["city"];
                        address.coordinates = Point2D.create2D(res["lon"], res["lat"]);
                        address.country = res["address"]["country"];
                        address.housenumber = parseInt(res["address"]["house_number"]);
                        address.postcode = parseInt(res["address"]["postcode"]);
                        address.state = res["address"]["state"];
                        address.street = res["address"]["road"];
                        callbackFn(undefined, address);
                    } else {
                        console.error("result from nominatim : ", result);
                        callbackFn(new Error("Could not find address in nominatim!" + result), undefined);
                    }
                }
            });
        } catch (e) {
            console.error("the raw error from the nominatim service : ", e);
            if (e.code === "ENOTFOUND" || e.code === "ENETUNREACH" || e.code === "ECONNREFUSED" || e.code === "ESOCKETTIMEDOUT") {
                callbackFn(new Error("Could not contact geocoder (nominatim) service (" + this.nominatimUrl + ")."), undefined);
            }
            else
                callbackFn(new Error("Error while finding address!" + e), undefined);
        };
    }
开发者ID:smallstack,项目名称:location-services,代码行数:35,代码来源:NominatimGeocodingService.ts


示例9: openCustomCHeMMenu

 /**
  * Display the menu to create a custom graph
  * @returns {void}
  */
 function openCustomCHeMMenu(): void 
 {
   $('.content .messages').empty();
   $('.chart').hide();
   $.get(root_path + 'templates/custom_menu.mst', function(template) {
     $('.content .messages').html( template );
   });
 }
开发者ID:delosh653,项目名称:SemNExT-Visualizations,代码行数:12,代码来源:ui.ts


示例10: safeParse

const defaultAreaService : AreaService = (() => {
    let elementaryAreas : { [id : number]: ElementaryArea } 
        = safeParse(window.localStorage.getItem(ELEMENTARY_LOCAL_STORAGE_KEY));
        
    const elementaryCallbacks = $.Callbacks();
    var editArea : ElementaryArea;
    let count = _.max(_.values(elementaryAreas).map((a : ElementaryArea) => a.id)) + 1;
    if (isNaN(count)) {
        count = 1;
    }
    
    $
    .get('http://localhost:8009/elementaryAreas/')
    .then(data => {
        elementaryAreas = data;
        elementaryCallbacks.fire(_.clone(elementaryAreas));
    });
    
    const getElementaryAreas = () => _.clone(elementaryAreas);
    
    const triggerAreasChange = () => { elementaryCallbacks.fire(getElementaryAreas()) };
    
    return {
        getElementaryAreas,
        addElementaryArea: function(area : ElementaryArea, id? : number) {
            const index = id || count++; 
            const newArea = _.clone(area);
            newArea.id = index;
            elementaryAreas[index] = newArea;
            elementaryCallbacks.fire(getElementaryAreas());
        },
        removeElementaryArea: function(id) {
            delete elementaryAreas[id];
            elementaryCallbacks.fire(getElementaryAreas());
        },
        onAreasChange: callback => elementaryCallbacks.add(callback),
        addPoint: (id, point) => elementaryAreas[id].points.push(point),
        setEditArea: id => {
            ToolService.setTool("draw");
            editArea = elementaryAreas[id];
            // TODO: make proper edit here
            editArea.points = [];
            editArea.polygon = Shapes.Polygon(editArea.points, false);
        },
        getCurrentEditArea: () => editArea,
        clearEditArea: () => {
            ToolService.setTool("selection");
            editArea = null;
        },
        setHighlight: function(id, highlight) {
            elementaryAreas[id].hover = highlight;
            elementaryAreas[id].polygon.color = highlight ? 'rgba(77, 163, 44, 0.4)' : null;
            triggerAreasChange();    
        },
        triggerAreasChange
    }
})();
开发者ID:lawliet29,项目名称:mp.backend,代码行数:57,代码来源:services.areas.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript jQuery.getJSON函数代码示例发布时间:2022-05-25
下一篇:
TypeScript jQuery.extend函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap