Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport (1-8-x) - Document BrowserView.{destroy,isDestroyed} #12298

Merged
merged 1 commit into from Mar 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/api/browser-view.md
Expand Up @@ -73,6 +73,16 @@ A `Integer` representing the unique ID of the view.

Objects created with `new BrowserView` have the following instance methods:

#### `view.destroy()`

Force closing the view, the `unload` and `beforeunload` events won't be emitted
for the web page. After you're done with a view, call this function in order to
free memory and other resources as soon as possible.

#### `view.isDestroyed()`

Returns `Boolean` - Whether the view is destroyed.

#### `view.setAutoResize(options)` _Experimental_

* `options` Object
Expand Down
16 changes: 16 additions & 0 deletions spec/api-browser-view-spec.js
Expand Up @@ -30,6 +30,22 @@ describe('BrowserView module', () => {
return closeWindow(w).then(() => { w = null })
})

describe('BrowserView.destroy()', () => {
it('does not throw', () => {
view = new BrowserView()
view.destroy()
})
})

describe('BrowserView.isDestroyed()', () => {
it('returns correct value', () => {
view = new BrowserView()
assert.ok(!view.isDestroyed())
view.destroy()
assert.ok(view.isDestroyed())
})
})

describe('BrowserView.setBackgroundColor()', () => {
it('does not throw for valid args', () => {
view = new BrowserView()
Expand Down