BroadcastChannel.close()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2022.

BroadcastChannel.close() 는 채널에 대한 연결을 종료하여, 객체가 가비지 컬렉션으로 처리되도록 합니다. 브라우저 입장에서 채널이 더 이상 필요하지 않다는 것을 알 수 있는 다른 방법이 없기 때문에, 이 단계는 반드시 수행해야 하는 단계입니다.

참고 : 이 기능은 Web Worker에서 사용할 수 있습니다.

구문

js
channel.close()

예제

js
// 채널에 연결
const bc = new BroadcastChannel("test_channel");

// postMessage 등의 동작들...

// 완료되면 채널 연결 해제
bc.close();

명세서

Specification
HTML
# dom-broadcastchannel-close-dev

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
close

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
User must explicitly enable this feature.

같이 보기