Add webContents.id property
This commit is contained in:
parent
8a061b7183
commit
998ce73ad9
3 changed files with 10 additions and 0 deletions
|
@ -1174,6 +1174,10 @@ v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
|
||||||
return v8::Null(isolate());
|
return v8::Null(isolate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t WebContents::ID() const {
|
||||||
|
return weak_map_id();
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
|
v8::Local<v8::Value> WebContents::Session(v8::Isolate* isolate) {
|
||||||
return v8::Local<v8::Value>::New(isolate, session_);
|
return v8::Local<v8::Value>::New(isolate, session_);
|
||||||
}
|
}
|
||||||
|
@ -1266,6 +1270,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
|
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
|
||||||
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
|
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
|
||||||
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
||||||
|
.SetProperty("id", &WebContents::ID)
|
||||||
.SetProperty("session", &WebContents::Session)
|
.SetProperty("session", &WebContents::Session)
|
||||||
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
||||||
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
|
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
|
||||||
|
|
|
@ -154,6 +154,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
v8::Local<v8::Value> GetOwnerBrowserWindow();
|
v8::Local<v8::Value> GetOwnerBrowserWindow();
|
||||||
|
|
||||||
// Properties.
|
// Properties.
|
||||||
|
int32_t ID() const;
|
||||||
v8::Local<v8::Value> Session(v8::Isolate* isolate);
|
v8::Local<v8::Value> Session(v8::Isolate* isolate);
|
||||||
content::WebContents* HostWebContents();
|
content::WebContents* HostWebContents();
|
||||||
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
|
v8::Local<v8::Value> DevToolsWebContents(v8::Isolate* isolate);
|
||||||
|
|
|
@ -913,6 +913,10 @@ win.webContents.on('did-finish-load', () => {
|
||||||
|
|
||||||
`WebContents` objects also have the following properties:
|
`WebContents` objects also have the following properties:
|
||||||
|
|
||||||
|
### `webContents.id`
|
||||||
|
|
||||||
|
The unique ID of this WebContents.
|
||||||
|
|
||||||
### `webContents.session`
|
### `webContents.session`
|
||||||
|
|
||||||
Returns the [session](session.md) object used by this webContents.
|
Returns the [session](session.md) object used by this webContents.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue