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


TypeScript js-cookie.get函數代碼示例

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


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

示例1: function

export let getToken = function (): TokenStateSchema | null {
  let user = Cookies.get('user');
  let token = Cookies.get('token');
  if (user !== undefined && token !== undefined) {
    return {token: token, user: user};
  }
  return null;
};
開發者ID:ttsvetanov,項目名稱:polyaxon,代碼行數:8,代碼來源:utils.ts

示例2: loadSessionState

export function loadSessionState() {
    return {
        type: LOAD_SESSION_STATE,
        payload: {
            gitHubAuthToken: cookies.get("gitHubAuthToken"),
            gitHubAuthState: cookies.get("gitHubAuthState"),
        },
    };
}
開發者ID:rx007,項目名稱:habitat,代碼行數:9,代碼來源:gitHub.ts

示例3: setVisitorInfo

  setVisitorInfo() {
    const visitorId = this._config.visitorId
      || Cookies.get(VISITOR_COOKIE_KEY)
      || uuid.v1();
    const sessionId = this._config.sessionId
      || Cookies.get(SESSION_COOKIE_KEY)
      || uuid.v1();

    this.setVisitor(visitorId, sessionId);
  }
開發者ID:groupby,項目名稱:searchandiser-ui,代碼行數:10,代碼來源:tracker.ts

示例4: applyTheme

 /**
  * Applies the theme to the website
  */
 public applyTheme() {
     if (Cookie.get('theme') == 'dark') {
         this.setDarkTheme();
     } else {
         this.setLightTheme();
     }
 }
開發者ID:SimonLoir,項目名稱:vicri2.0,代碼行數:10,代碼來源:dashboard.view.ts

示例5: normalizeBaseURL

export const createAJAXSettings = (
  serverConfig: ServerConfig,
  uri = "/",
  opts: Partial<AjaxRequest> = {}
): AjaxRequest => {
  const baseURL = normalizeBaseURL(serverConfig.endpoint || serverConfig.url);
  const url = `${baseURL}${uri}`;
  // Use the server config provided token if available before trying cookies
  const xsrfToken = serverConfig.xsrfToken || Cookies.get("_xsrf");
  const headers = {
    "X-XSRFToken": xsrfToken,
    Authorization: `token ${serverConfig.token ? serverConfig.token : ""}`
  };

  // Merge in our typical settings for responseType, allow setting additional
  // options like the method
  const settings = {
    url,
    responseType: "json",
    createXHR: () => new XMLHttpRequest(),
    ...serverConfig,
    ...opts,
    // Make sure we merge in the auth headers with user given headers
    headers: { ...headers, ...opts.headers }
  };
  delete settings.endpoint;
  return settings;
};
開發者ID:kelleyblackmore,項目名稱:nteract,代碼行數:28,代碼來源:base.ts

示例6: fetchGitHubRepos

export function fetchGitHubRepos(org, page = 1, username) {
    const token = cookies.get("gitHubAuthToken");
    const urlPath = username ? `users/${username}/repos` : `orgs/${org}/repos`;

    return dispatch => {
        if (page === 1) {
            dispatch(setGitHubReposLoadingFlag(true));
        }

        fetch(`https://api.github.com/${urlPath}?access_token=${token}&per_page=100&page=${page}`).then(response => {
            const links = parseLinkHeader(response.headers.get("Link"));

            // When we get the first page, clear everything out
            if (page === 1) { dispatch(resetGitHubRepos()); }

            if (links && links.next && links.next.page) {
                dispatch(fetchGitHubRepos(org, links.next.page, username));
            } else {
                dispatch(setGitHubReposLoadingFlag(false));
            }

            response.json().then(data => dispatch(populateGitHubRepos(data)));
        });
    };
}
開發者ID:rx007,項目名稱:habitat,代碼行數:25,代碼來源:gitHub.ts

示例7: score_update

    score_update(add_to_score:number) {
        this.max_score = parseInt(Cookies.get('max_score'), 10) || 0;

        this.score += add_to_score;
        if (this.score > this.max_score) {
            Cookies.set('max_score', this.max_score);
        }
    }
開發者ID:rtaycher,項目名稱:2048-Clone,代碼行數:8,代碼來源:game.ts

示例8: addToBasket

  public static addToBasket(item) {
    const basket = JSON.parse(Cookies.get('basket'));
    const {id} = basket;
    const uri = `${ITEM_URI}/${id}/order_items`;
    const data = {size: item.size, shoeModelId: item.id};

    APIUtils.post(uri, data)
      .then(BasketServerActions.receiveBasketItemPush);
  }
開發者ID:nshahpazov,項目名稱:shoes-front-end,代碼行數:9,代碼來源:BasketUtils.ts

示例9: setGitHubAuthState

export function setGitHubAuthState() {
    let payload = cookies.get("gitHubAuthState") || uuid();
    setCookie("gitHubAuthState", payload);

    return {
        type: SET_GITHUB_AUTH_STATE,
        payload
    };
}
開發者ID:rx007,項目名稱:habitat,代碼行數:9,代碼來源:gitHub.ts

示例10: constructor

    constructor(x_size, y_size) {
        this.array = [];
        this.x_size = x_size;
        this.y_size = y_size;
        this.score = 0;
        this.max_score = parseInt(Cookies.get('max_score'), 10) || 0;

        for (let i = 0; i < this.x_size * this.y_size; i++) {
            this.array[i] = null;
        }
    }
開發者ID:rtaycher,項目名稱:2048-Clone,代碼行數:11,代碼來源:game.ts


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