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


TypeScript jQuery.get函数代码示例

本文整理汇总了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;未经允许,请勿转载。