From 1b1735bca932fa6b6cc86cccccbb68cb72c60d61 Mon Sep 17 00:00:00 2001 From: Robo Date: Sat, 9 May 2015 23:33:16 +0530 Subject: [PATCH] avoid unnecessary api calls --- atom/browser/api/atom_api_window.cc | 4 ++-- docs/api/browser-window.md | 10 ---------- spec/api-browser-window-spec.coffee | 14 ++++++++------ 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index dcdc10d..f7f6c72 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -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() { diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 056148b..d95baa5 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -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' diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index 12f790d..fb5c26a 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -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] -- 2.7.4