Skip to content

Refactor#1

Open
rsj2003 wants to merge 10 commits intomasterfrom
refactor
Open

Refactor#1
rsj2003 wants to merge 10 commits intomasterfrom
refactor

Conversation

@rsj2003
Copy link
Copy Markdown
Owner

@rsj2003 rsj2003 commented Aug 21, 2020

No description provided.

Comment on lines +1 to +36
export default Object.freeze({

/**
* 저장소의 아이템을 가져옴
* @param key {string}
* @returns {*}
*/
get(key) {
return JSON.parse(localStorage.getItem(key) || 'null');
},

/**
* 저장소의 아이템을 교체함
* @param key {string}
* @param value {*}
*/
set(key, value) {
localStorage.setItem(key, JSON.stringify(value));
},

/**
* key에 value를 할당하고, toogle 시킴
* @param key {string}
* @param value {string}
* @param toggle {'t'|'f'}
*/
toggle(key, value, toggle) {
if (this.get(key) === null) {
this.set(key, [value, toggle]);
return;
}
const before = this.get(key).split(',')[0];
this.set(key, [value, before === 't' ? 'f' : 't']);
},

}); No newline at end of file
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color 관련 작업은 ColorService로 분리하면 좋습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant