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


TypeScript JsonServiceClient.post方法代碼示例

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


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

示例1: evalExpression

export function evalExpression(gist: string, scriptId: string, expr: string) {
    if (!expr)
        return;

    const request = new EvaluateExpression();
    request.scriptId = scriptId;
    request.expression = expr;
    request.includeJson = true;

    ReactGA.event({ category: 'preview', action: 'Evaluate Expression', label: gist + ": " + expr.substring(0, 50) });

    client.post(request)
        .then(r => {
            if (r.result.errors && r.result.errors.length > 0) {
                r.result.errors.forEach(x => {
                    store.dispatch({ type: 'CONSOLE_LOG', logs: [{ msg: x.info, cls: "error" }] });
                });
            } else {
                store.dispatch({ type: 'EXPRESSION_LOAD', expressionResult: r.result });
            }
        })
        .catch(e => {
            var status = e.responseStatus || e; //both have schema `{ message }`
            store.dispatch({ type: 'CONSOLE_LOG', logs: [statusToError(status)] });
        });
};
開發者ID:ServiceStack,項目名稱:Gistlyn,代碼行數:26,代碼來源:utils.ts

示例2: testClient

function testClient() {
    client.get(Object.assign(new Hello(), { name: "GET" })).then(show);
    client.post(Object.assign(new Hello(), { name: "POST" })).then(show);
    client.put(Object.assign(new Hello(), { name: "PUT" })).then(show);
};
開發者ID:ServiceStack,項目名稱:Test,代碼行數:5,代碼來源:app.ts

示例3: helloTypes

        });
    },
    helloTypes () {
        var request = new HelloTypes();
        request.string = this.value;
        request.bool = false;
        request.int = 0;
        client.get(request).then((r) => {
            $("#helloTypesResult").html(JSON.stringify(r));
        });
    },
    echoTypes() {
        var request = new EchoTypes();
        request.string = this.value;

        client.post(request).then(r => {
            $("#echoTypesResult").html(r.string);
        });
    },
    rawString() {
        var request = new ReturnString();
        request.data = this.value;

        client.get(request)
            .then(text => {
                $("#rawStringResult").html(text);
            });
    },
    rawBytes() {
        const bytesToBase64 = (array) => btoa(String.fromCharCode.apply(null, new Uint8Array(array)));
        const base64ToBytes = (b64) => new Uint8Array(atob(b64).split("").map(c => c.charCodeAt(0)));
開發者ID:ServiceStack,項目名稱:Test,代碼行數:31,代碼來源:app.ts


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