avoid unnecessary api calls

This commit is contained in:
Robo 2015-05-09 23:33:16 +05:30 committed by deepak1556
parent 3a5977e09f
commit 1b1735bca9
3 changed files with 10 additions and 18 deletions

View file

@ -125,11 +125,11 @@ void Window::OnWindowRestore() {
}
void Window::OnWindowResize() {
Emit("resize", GetBounds().size());
Emit("resize");
}
void Window::OnWindowMove() {
Emit("move", window_->GetPosition());
Emit("move");
}
void Window::OnWindowEnterFullScreen() {

View file

@ -173,20 +173,10 @@ Emitted when window is restored from minimized state.
### Event: 'resize'
* `event` Event
* `value` Object
* `width` Integer
* `height` Integer
Emitted when window is resized.
### Event: 'move'
* `event` Event
* `value` Object
* `x` Integer
* `y` Integer
Emitted when window is moved.
### Event: 'enter-full-screen'

View file

@ -92,18 +92,20 @@ describe 'browser-window module', ->
describe 'BrowserWindow.setSize(width, height)', ->
it 'sets the window size', (done) ->
size = [20, 400]
w.on 'resize', (e, value) ->
assert.equal value.width, size[0]
assert.equal value.height, size[1]
w.on 'resize', ->
newSize = w.getSize()
assert.equal newSize[0], size[0]
assert.equal newSize[1], size[1]
done()
w.setSize size[0], size[1]
describe 'BrowserWindow.setPosition(x, y)', ->
it 'sets the window position', (done) ->
pos = [10, 10]
w.on 'move', (e, value) ->
assert.equal value.x, pos[0]
assert.equal value.y, pos[1]
w.on 'move', ->
newPos = w.getPosition()
assert.equal newPos[0], pos[0]
assert.equal newPos[1], pos[1]
done()
w.setPosition pos[0], pos[1]