當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ajax.getJSON方法代碼示例

本文整理匯總了TypeScript中rxjs/ajax.ajax.getJSON方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ajax.getJSON方法的具體用法?TypeScript ajax.getJSON怎麽用?TypeScript ajax.getJSON使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rxjs/ajax.ajax的用法示例。


在下文中一共展示了ajax.getJSON方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getDepth

export function getDepth(direction: Direction) {
  const directionalCompare = (a: OrderType, b: OrderType) =>
    direction === Direction.buy
      ? b.price > a.price
      : a.price > b.price
  return ajax.getJSON<OrderType[]>(`${URL}/depth/${direction}`).pipe(
    map((orders) => orders.sort((a, b) => directionalCompare(a, b) ? 1 : -1).slice(0, 3)),
  )
}
開發者ID:Carl-Foster,項目名稱:exchange-app,代碼行數:9,代碼來源:exchange.ts

示例2: merge

    (selectedView: IView | null) => selectedView == null
      ? EMPTY
      : merge(
        // initial fetch
        ajax.getJSON<IViewData>(`api/viewdata/${selectedView.id}`).pipe(catchError(() => EMPTY)),

        // keep polling
        observableOf(null)
          .pipe(delay(3000))
          .pipe(mergeMap(() => ajax.getJSON<IViewData>(`api/viewdata/${selectedView.id}`).pipe(catchError(() => EMPTY))))
          .pipe(repeat<IViewData | null>())
      )
開發者ID:amoerie,項目名稱:teamcity-theatre,代碼行數:12,代碼來源:dashboard.observables.ts

示例3:

 .pipe(switchMap<View | null, IView[]>(() => ajax.getJSON<IView[]>("api/views")))
開發者ID:amoerie,項目名稱:teamcity-theatre,代碼行數:1,代碼來源:settings.observables.views.ts

示例4:

 .pipe(mergeMap(() => ajax.getJSON<IViewData>(`api/viewdata/${selectedView.id}`).pipe(catchError(() => EMPTY))))
開發者ID:amoerie,項目名稱:teamcity-theatre,代碼行數:1,代碼來源:dashboard.observables.ts

示例5: observableDefer

export const allViews: Observable<IView[] | null> = observableDefer(() => ajax.getJSON<IView[]>("api/views"));
開發者ID:amoerie,項目名稱:teamcity-theatre,代碼行數:1,代碼來源:dashboard.observables.ts

示例6:

export const getMappings = (server: IServer) =>
    ajax.getJSON(buildApiUrl(server, '/mappings'))
開發者ID:manishshanker,項目名稱:wiremock-ui,代碼行數:2,代碼來源:api.ts

示例7: switchMap

 switchMap(project => ajax.getJSON<IDetailedProject>(`api/projects/${project.id}`).pipe(
   map(detailedProject => project.withBuildConfigurations(detailedProject.buildConfigurations.map(BuildConfiguration.fromContract))),
   startWith<Project | null>(null))),
開發者ID:amoerie,項目名稱:teamcity-theatre,代碼行數:3,代碼來源:settings.observables.selected-project.ts

示例8: observableDefer

const initialRootProjects: Observable<Project> = observableDefer(() => ajax.getJSON<IBasicProject[]>("api/projects")).pipe(
開發者ID:amoerie,項目名稱:teamcity-theatre,代碼行數:1,代碼來源:settings.observables.projects.ts


注:本文中的rxjs/ajax.ajax.getJSON方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。