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


TypeScript mithril.buildQueryString函數代碼示例

本文整理匯總了TypeScript中mithril.buildQueryString函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript buildQueryString函數的具體用法?TypeScript buildQueryString怎麽用?TypeScript buildQueryString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: apiCurrentAccessTokensPath

 static apiCurrentAccessTokensPath(filter?: "all" | "revoked" | "active") {
   if (filter) {
     return `/go/api/current_user/access_tokens?${m.buildQueryString({filter})}`;
   } else {
     return `/go/api/current_user/access_tokens`;
   }
 }
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:7,代碼來源:spark_routes.ts

示例2: pipelineMaterialSearchPath

 static pipelineMaterialSearchPath(pipelineName: string, fingerprint: string, searchText: string): string {
   const queryString = m.buildQueryString({
                                            fingerprint,
                                            pipeline_name: pipelineName,
                                            search_text: searchText
                                          });
   return `/go/api/internal/material_search?${queryString}`;
 }
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:8,代碼來源:spark_routes.ts

示例3: queryConfig

export function queryConfig(pattern = "%"): Promise<any[]> {
  const filter = stringify(["LIKE", ["PARAM", "_id"], pattern]);
  return m.request({
    method: "GET",
    url: `api/config/?${m.buildQueryString({ filter: filter })}`,
    background: true
  });
}
開發者ID:zaidka,項目名稱:genieacs,代碼行數:8,代碼來源:store.ts

示例4: resourceExists

export function resourceExists(resource, id): Promise<number> {
  const param = resource === "devices" ? "DeviceID.ID" : "_id";
  const filter = ["=", ["PARAM", param], id];
  return m.request({
    method: "HEAD",
    url:
      `/api/${resource}/?` +
      m.buildQueryString({
        filter: memoizedStringify(filter)
      }),
    extract: xhr => +xhr.getResponseHeader("x-total-count"),
    background: true
  });
}
開發者ID:zaidka,項目名稱:genieacs,代碼行數:14,代碼來源:store.ts

示例5: Promise

            new Promise((resolve2, reject2) => {
              m.request({
                method: "GET",
                url:
                  `/api/${resourceType}/?` +
                  m.buildQueryString({
                    filter: memoizedStringify(combinedFilterDiff)
                  })
              })
                .then(res => {
                  for (const r of res as {}[]) {
                    const id =
                      resourceType === "devices"
                        ? r["DeviceID.ID"].value[0]
                        : r["_id"];
                    resources[resourceType].objects.set(id, r);
                    deleted.delete(id);
                  }

                  for (const d of deleted) {
                    const obj = resources[resourceType].objects.get(d);
                    if (evaluate(combinedFilterDiff, obj, fulfillTimestamp))
                      resources[resourceType].objects.delete(d);
                  }

                  for (const queryResponse of toFetch) {
                    let filter = queries.filter.get(queryResponse);
                    filter = unpackExpression(filter);
                    const limit = queries.limit.get(queryResponse);
                    const bookmark = queries.bookmark.get(queryResponse);
                    const sort = queries.sort.get(queryResponse);
                    if (bookmark) filter = limitFilter(filter, sort, bookmark);

                    queries.value.set(
                      queryResponse,
                      findMatches(resourceType, filter, sort, limit)
                    );
                    queries.fulfilled.set(queryResponse, fulfillTimestamp);
                    queries.fulfilling.delete(queryResponse);
                  }
                  resolve2();
                })
                .catch(reject2);
            })
開發者ID:zaidka,項目名稱:genieacs,代碼行數:44,代碼來源:store.ts

示例6: m

 view: () => {
   if (window.username) {
     return m(
       "div.user-menu",
       window.username,
       m(
         "button",
         {
           onclick: e => {
             e.target.disabled = true;
             store
               .logOut()
               .then(() => {
                 location.hash = "";
                 location.reload();
               })
               .catch(err => {
                 e.target.disabled = false;
                 notifications.push("error", err.message);
               });
             return false;
           }
         },
         "Log out"
       )
     );
   } else {
     return m(
       "div.user-menu",
       m(
         "a",
         {
           href:
             "#!/login?" + m.buildQueryString({ continue: m.route.get() })
         },
         "Log in"
       )
     );
   }
 }
開發者ID:zaidka,項目名稱:genieacs,代碼行數:40,代碼來源:user-menu.ts

示例7: showDashboardPath

 static showDashboardPath(viewName?: string): string {
   if (viewName) {
     return `/go/api/dashboard?${m.buildQueryString({viewName})}`;
   }
   return "/go/api/dashboard";
 }
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:6,代碼來源:spark_routes.ts

示例8: apiUsersSearchPath

 static apiUsersSearchPath(searchText: string) {
   return `/go/api/user_search?${m.buildQueryString({q: searchText})}`;
 }
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:3,代碼來源:spark_routes.ts


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