mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
2 lines
5.5 KiB
JavaScript
2 lines
5.5 KiB
JavaScript
|
/*! For license information please see 0fc2b25d.0c34cc68.js.LICENSE.txt */
|
||
|
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[10948],{29044:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>d,contentTitle:()=>c,default:()=>a,frontMatter:()=>n,metadata:()=>o,toc:()=>p});var s=r(85893),i=r(11151);const n={sidebar_label:"DeviceRequestPrompt"},c="DeviceRequestPrompt class",o={id:"api/puppeteer.devicerequestprompt",title:"DeviceRequestPrompt class",description:"Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth.",source:"@site/versioned_docs/version-22.0.0/api/puppeteer.devicerequestprompt.md",sourceDirName:"api",slug:"/api/puppeteer.devicerequestprompt",permalink:"/api/puppeteer.devicerequestprompt",draft:!1,unlisted:!1,tags:[],version:"22.0.0",frontMatter:{sidebar_label:"DeviceRequestPrompt"},sidebar:"api",previous:{title:"Device",permalink:"/api/puppeteer.device"},next:{title:"DeviceRequestPrompt.cancel",permalink:"/api/puppeteer.devicerequestprompt.cancel"}},d={},p=[{value:"Signature:",id:"signature",level:4},{value:"Remarks",id:"remarks",level:2},{value:"Example",id:"example",level:2},{value:"Properties",id:"properties",level:2},{value:"Methods",id:"methods",level:2}];function l(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h4:"h4",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,i.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.h1,{id:"devicerequestprompt-class",children:"DeviceRequestPrompt class"}),"\n",(0,s.jsx)(t.p,{children:"Device request prompts let you respond to the page requesting for a device through an API like WebBluetooth."}),"\n",(0,s.jsx)(t.h4,{id:"signature",children:"Signature:"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-typescript",children:"export declare class DeviceRequestPrompt\n"})}),"\n",(0,s.jsx)(t.h2,{id:"remarks",children:"Remarks"}),"\n",(0,s.jsxs)(t.p,{children:[(0,s.jsx)(t.code,{children:"DeviceRequestPrompt"})," instances are returned via the ",(0,s.jsx)(t.a,{href:"/api/puppeteer.page.waitfordeviceprompt",children:"Page.waitForDevicePrompt()"})," method."]}),"\n",(0,s.jsxs)(t.p,{children:["The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ",(0,s.jsx)(t.code,{children:"DeviceRequestPrompt"})," class."]}),"\n",(0,s.jsx)(t.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-ts",children:"const [deviceRequest] = Promise.all([\n page.waitForDevicePrompt(),\n page.click('#connect-bluetooth'),\n]);\nawait devicePrompt.select(\n await devicePrompt.waitForDevice(({name}) => name.includes('My Device'))\n);\n"})}),"\n",(0,s.jsx)(t.h2,{id:"properties",children:"Properties"}),"\n",(0,s.jsxs)(t.table,{children:[(0,s.jsx)(t.thead,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.th,{children:"Property"}),(0,s.jsx)(t.th,{children:"Modifiers"}),(0,s.jsx)(t.th,{children:"Type"}),(0,s.jsx)(t.th,{children:"Description"})]})}),(0,s.jsx)(t.tbody,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:"devices"}),(0,s.jsx)(t.td,{}),(0,s.jsxs)(t.td,{children:[(0,s.jsx)(t.a,{href:"/api/puppeteer.devicerequestpromptdevice",children:"DeviceRequestPromptDevice"}),"[]"]}),(0,s.jsx)(t.td,{children:"Current list of selectable devices."})]})})]}),"\n",(0,s.jsx)(t.h2,{id:"methods",children:"Methods"}),"\n",(0,s.jsxs)(t.table,{children:[(0,s.jsx)(t.thead,{children:(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.th,{children:"Method"}),(0,s.jsx)(t.th,{children:"Modifiers"}),(0,s.jsx)(t.th,{children:"Description"})]})}),(0,s.jsxs)(t.tbody,{children:[(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:(0,s.jsx)(t.a,{href:"/api/puppeteer.devicerequestprompt.cancel",children:"cancel()"})}),(0,s.jsx)(t.td,{}),(0,s.jsx)(t.td,{children:"Cancel the prompt."})]}),(0,s.jsxs)(t.tr,{children:[(0,s.jsx)(t.td,{children:(0,s.jsx)(t.a,{href:"/api/puppeteer.devicerequestprompt.select",children:"select(device)"})}),(0,s.jsx)(t.td,{}),(0,s.jsx)(t.td,{children:"Select a device in the prompt's list."})]}),(0,s
|