mirror of
https://github.com/keymanapp/keyman.git
synced 2026-11-03 09:37:47 +00:00
Merge pull request #15428 from keymanapp/refactor/web/publicprivate
refactor(web): explicitly specify public/private on CookieSerializer 🍪
This commit is contained in:
commit
c7fecbf4bd
1 changed files with 4 additions and 4 deletions
|
|
@ -4,17 +4,17 @@ type FilteredRecordEncoder = (value: DecodedCookieFieldValue, key: string) => st
|
|||
type FilteredRecordDecoder = (value: string, key: string) => DecodedCookieFieldValue;
|
||||
|
||||
export class CookieSerializer<Type extends Record<keyof Type, DecodedCookieFieldValue>> {
|
||||
readonly name: string;
|
||||
private readonly name: string;
|
||||
|
||||
constructor(name: string) {
|
||||
public constructor(name: string) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
load(decoder?: FilteredRecordDecoder): Type {
|
||||
public load(decoder?: FilteredRecordDecoder): Type {
|
||||
return this.loadCookie(this.name, decoder || ((val: string) => val as DecodedCookieFieldValue)) as Type;
|
||||
}
|
||||
|
||||
save(cookie: Type, encoder?: FilteredRecordEncoder) {
|
||||
public save(cookie: Type, encoder?: FilteredRecordEncoder) {
|
||||
this.saveCookie(this.name, cookie, encoder || ((val: DecodedCookieFieldValue) => val as string));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue