diff options
Diffstat (limited to 'files/ko/web/api/customevent/detail/index.md')
-rw-r--r-- | files/ko/web/api/customevent/detail/index.md | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/files/ko/web/api/customevent/detail/index.md b/files/ko/web/api/customevent/detail/index.md new file mode 100644 index 0000000000..88043995e0 --- /dev/null +++ b/files/ko/web/api/customevent/detail/index.md @@ -0,0 +1,54 @@ +--- +title: CustomEvent.detail +slug: Web/API/CustomEvent/detail +tags: + - Property + - Reference + - Read-only +browser-compat: api.CustomEvent.detail +translation_of: Web/API/CustomEvent/detail +--- +{{APIRef("DOM")}} + +{{domxref("CustomEvent")}} 인터페이스의 **`detail`** 읽기 전용 속성은 이벤트를 초기화할 때 제공한 데이터를 반환합니다. + +## 값 + +이벤트를 초기화할 때 제공한 아무 데이터. + +## 예제 + +```js +// CustomEvent 생성 +const catFound = new CustomEvent('animalfound', { + detail: { + name: 'cat' + } +}); +const dogFound = new CustomEvent('animalfound', { + detail: { + name: 'dog' + } +}); + +// 적합한 이벤트 수신기 부착 +obj.addEventListener('animalfound', (e) => console.log(e.detail.name)); + +// 이벤트 발송 +obj.dispatchEvent(catFound); +obj.dispatchEvent(dogFound); + +// 콘솔에 "cat"과 "dog"가 기록됨 +``` + +## 명세 + +{{Specifications}} + +## 브라우저 호환성 + +{{Compat}} + +## 같이 보기 + +- {{domxref("CustomEvent")}} |