This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| const MODAL_CLOSED = false; | |
| const MODAL_OPENED = true; | |
| function useCommonModal(initialState = MODAL_CLOSED) { | |
| const [isOpened, setIsOpened] = React.useState(initialState); | |
| const open = () => { | |
| setIsOpened(MODAL_OPENED); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const _$ = (selector, base=document) => base.querySelector(selector); | |
| const _$$ = (selector, base=document) => base.querySelectorAll(selector); | |
| export { _$, _$$ }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bootstrap 3 vs. 4 | |
| - 3은 px 단위이고 4는 em 단위 | |
| - 4에서는 old ie 버전을 지원하지 않음 | |
| - 3을 사용하는 이유는 좋은 plug-in 들이 3 기반이기 때문이었는데... | |
| 이제는 4에서도 지원함 예) summer note, sb admin | |
| # Summer note | |
| - 관련 css, js 선언하고 | |
| - 아래와 같이 id값을 동일하게 선언하면 됨 | |
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Bootstrap 3 vs. 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function EventBus() { | |
| const subscriptions = { }; | |
| this.on = function subscribeCallbackToEvent(eventType, callback) { | |
| const id = Symbol('id'); | |
| if (!subscriptions[eventType]) subscriptions[eventType] = { }; | |
| subscriptions[eventType][id] = callback; | |
| return { | |
| off: function off() { | |
| delete subscriptions[eventType][id]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Webcam</title> | |
| <script> | |
| function play() { | |
| var video = document.querySelector('#video'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = class Observable { | |
| constructor() { | |
| this._observers = new Set(); | |
| } | |
| subscribe(observer) { | |
| this._observers.add(observer); | |
| } | |
| unsubscribe(observer) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const util = { | |
| sleep(ms) { // ms: milliseconds | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| }; | |
| module.exports = util; |