本文整理匯總了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`;
}
}
示例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}`;
}
示例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
});
}
示例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
});
}
示例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);
})
示例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"
)
);
}
}
示例7: showDashboardPath
static showDashboardPath(viewName?: string): string {
if (viewName) {
return `/go/api/dashboard?${m.buildQueryString({viewName})}`;
}
return "/go/api/dashboard";
}
示例8: apiUsersSearchPath
static apiUsersSearchPath(searchText: string) {
return `/go/api/user_search?${m.buildQueryString({q: searchText})}`;
}