-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TypeScript & Module Typing] 병민(윤병인) 미션 제출합니다. #7
Merged
+11,532
−106
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
a7a1110
chore: gitignore 추가
airman5573 026d41f
chore: tsd command 추가
airman5573 e4aa3ee
typo: 모듈 이름 및 lint적용
airman5573 d7c2e1f
feat: 파일 위치 이동
airman5573 710990f
test: TQuery test 추가
airman5573 f8aff81
feat: 함수를 파일별로 분리한다
airman5573 51b9ddc
feat: isNumber 유틸 함수 추가
airman5573 faeaf4b
feat: tQuery구현 및 테스트 추가
airman5573 e1dd875
chore: tsd 경로 수정
airman5573 a71f4ac
feat: TQuery 구현
airman5573 d4171e7
feat: isNull 테스트 추가
airman5573 4b5153e
feat: isNull 구현 추가
airman5573 bfaccad
feat: isNull 구현부 추가
airman5573 f0444b5
feat: 타입검사의 강도를 낮춘다
airman5573 fbe56b1
feat: isNil type test 추가
airman5573 0c7d128
feat: isNil 구현 및 api 테스트
airman5573 b205bae
feat: isFunction 타입 테스트 추가
airman5573 8d232c3
feat: isFunction 기능 테스트 추가
airman5573 a4a6160
feat: isFunction type 개선
airman5573 455467c
feat: isFunction type test추가
airman5573 4eb97f1
feat: throttle & debounce api test 추가
airman5573 a46d13b
feat: memoize 구현 및 테스트 추가
airman5573 66a6c03
clean: console.log 삭제
airman5573 55171a0
feat: TQuery관련 테스트 추가
airman5573 151e990
feat: shuffle type test추가
airman5573 ecfb517
feat: shuffle 기능 구현 및 테스트 추가
airman5573 285fb63
feat: pick type test 추가
airman5573 dac93e0
feat: pick 구현 및 테스트 추가
airman5573 01ecf24
feat: omit type test 추가
airman5573 412c390
feat: omit 구현 및 테스트 추가
airman5573 6310f36
feat: fetch 함수 추가
airman5573 425d5d0
feat: fetch 함수 추가
airman5573 7518338
merge
airman5573 5b0996f
feat: clickOutside 구현 추가
airman5573 6ac4fde
fix: addEventLitener에 handler를 적용한다
airman5573 9cae053
refactor: return을 더 짧게 작성한다
airman5573 6ece090
cache타입을 수정한다
airman5573 6ca0077
refactor: type 단일 출처 유지
airman5573 ad2340a
chore: 불필요한 설정을 제거한다
airman5573 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: clickOutside 구현 추가
commit 5b0996fd8a7ed646a993716fdcb02d0a25ce9344
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
const clickOutside = () => {}; | ||
const clickOutside = (selector: string, callback: () => void) => { | ||
const element = document.querySelector(selector); | ||
if (!element) return; | ||
const handler = (event: MouseEvent) => { | ||
const path = event.composedPath(); | ||
const hasElementClicked = path.some((p) => p === element); | ||
!hasElementClicked && callback(); | ||
}; | ||
window.addEventListener("click", (event: MouseEvent) => { | ||
const path = event.composedPath(); | ||
const hasElementClicked = path.some((p) => p === element); | ||
!hasElementClicked && callback(); | ||
}); | ||
|
||
return () => window.removeEventListener("click", handler); | ||
}; | ||
|
||
export default clickOutside; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 경우에 handler가 removeEventListener에만 있고 addEventListener에는 익명 함수로 등록되어 있어 removeEventListener가 제대로 동작하지 않을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다 :D
6ac4fde