This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

Clients: get() 메서드

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2018년 4월⁩.

참고 : This feature is only available in Service Workers.

Clients 인터페이스의 get() 메서드는 주어진 id와 일치하는 서비스 워커 클라이언트를 가져와 Promise로 반환합니다.

구문

js
get(id)

매개변수

id

가져오려고 하는 클라이언트의 아이디를 나타내는 문자열.

반환 값

Client 객체나 undefined로 이행된 Promise.

예제

js
self.clients.get(id).then((client) => {
  self.clients.openWindow(client.url);
});

명세서

Specification
Service Workers
# clients-get

브라우저 호환성