本文整理汇总了TypeScript中js-cookie.set函数的典型用法代码示例。如果您正苦于以下问题:TypeScript set函数的具体用法?TypeScript set怎么用?TypeScript set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: switch
(state: TokenStateSchema = TokenEmptyState, action: TokenAction) => {
switch (action.type) {
case actionTypes.RECEIVE_TOKEN:
Cookies.set('token', action.token.token);
Cookies.set('user', action.username);
return {
...state,
user: action.username,
token: action.token.token
};
case actionTypes.DISCARD_TOKEN:
Cookies.remove('token');
Cookies.remove('user');
Cookies.remove('sessionid');
Cookies.remove('csrftoken');
return {
...state,
user: '',
token: ''
};
default:
return state;
}
};
示例2: setDevCookie
function setDevCookie(e: JQuery.Event) {
e.preventDefault();
Cookies.set('vault-dev-username', $('#Username').val() as string);
Cookies.set('vault-dev-password', $('#Password').val() as string);
alert('Cookie set');
}
示例3:
set: (
v: string | object,
options: Cookies.CookieAttributes = {
domain: '.linode.com',
expires: 1000 * 60 * 60 * 24 * 356
}
) => Cookies.set('loginCloudManager', v, options)
示例4: 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);
}
}
示例5: setCookie
export function setCookie (key, value) {
return cookies.set(key, value, {
domain: cookieDomain(),
secure: window.location.protocol === "https"
});
}
示例6: _setAuthToken
protected _setAuthToken(token: string): void {
if (!token) return;
Cookie.set(COOKIE_AUTH_TOKEN_KEY, token, { expires: 1 });
}
示例7: setToken
export function setToken(token: string) {
return Cookies.set(TokenKey, token);
}
示例8: moveToMypage
moveToMypage ({ dispatch }): void {
dispatch('moveTo', Constants.URL_RJ_MYPAGE)
},
reload ({ dispatch }): void {
dispatch('beforeunloadAlertEventListener', 'remove')
window.location.reload()
},
closeTab ({ dispatch }): void {
dispatch('beforeunloadAlertEventListener', 'remove')
window.close()
},
getCookie ({ state }, name: string) {
return Cookies.get(name)
},
setCookie ({ state }, params): void {
Cookies.set(params.name, params.value)
},
removeCookie ({ state }, name: string): void {
Cookies.remove(name)
},
sendErrorLog ({ rootState }, error): void {
const detail =
typeof error === 'object' && error.stack !== 'undefined'
? error.stack
: error
GibsonApi.postLog(
rootState.lesson.lessonInfo.registrationId,
'error',
detail
)
}
示例9: setVisitor
setVisitor(visitorId: string, sessionId: string) {
this.tracker.setVisitor(visitorId, sessionId);
Cookies.set(VISITOR_COOKIE_KEY, visitorId, { expires: MAX_COOKIE_AGE });
Cookies.set(SESSION_COOKIE_KEY, sessionId);
}
示例10: setCookie
function setCookie (key, value) {
return cookies.set(key, value, {
secure: window.location.protocol === "https"
});
}