new Browser()
- Source:
Properties:
Name | Type | Description |
---|---|---|
id |
string | browser实例的唯一id |
isReady |
boolean | 是否为就绪状态,即构建完成,可以获取page |
isFront |
boolean | 是否为激活状态 |
browserManager |
BrowserManager | |
options |
Object | 传入的配置信息 |
Extends
Members
idleTime
- Source:
闲置时间 当前非激活时长,激活时会被清0
Methods
(async) init()
- Source:
Browser的初始化
getBoundingClientRect()
- Source:
获取browser相对于视窗的信息
build()
- Source:
Browser的构建
bringToFront()
- Source:
将browser提到视窗最前端,相当于多个browser,切换到当前
close()
- Source:
关闭browser
(async) pages() → {Array.<Page>}
- Source:
获取browser下的所有page实例集合
Returns:
- Type
- Array.<Page>
getPageById() → {Page}
- Source:
通过pageid获取指定page实例
Returns:
- Type
- Page
frontPage() → {Page}
- Source:
获取当前激活的page
Returns:
- Type
- Page
newPage(urlopt, referreropt) → {Promise.<Page>}
- Source:
新建页面
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string |
<optional> |
页面跳转地址,不传则跳转到browser的startUrl |
referrer |
string |
<optional> |
referrer,不传则为browser的startUrlReferrer |
Returns:
返回构建的page实例
- Type
- Promise.<Page>
_newPageWithoutReady(opener, urlopt, referreropt) → {Page}
- Source:
新建页面, 不等待页面加载完成
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opener |
Target | 打开当前页面的opener |
|
url |
string |
<optional> |
页面跳转地址,不传则跳转到browser的startUrl |
referrer |
string |
<optional> |
referrer,不传则为browser的startUrlReferrer |
Returns:
返回构建的page实例
- Type
- Page
Events
back
- Source:
当前browser取消激活时触发
front
- Source:
当前browser激活时触发
close
- Source:
当前browser关闭时触发
new-page
- Source:
当前browser新建page时触发, 此时page还未构建完毕
Type:
targetcreated
- Source:
打开新标签页时触发
Type:
targetchanged
- Source:
打开的页面url变更时触发
Type:
targetdestroyed
- Source:
新打开的页面关闭时触发