Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 82E2E11E18 for ; Mon, 5 May 2014 16:09:34 +0000 (UTC) Received: (qmail 20990 invoked by uid 500); 5 May 2014 16:09:17 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 20735 invoked by uid 500); 5 May 2014 16:09:11 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 20232 invoked by uid 99); 5 May 2014 16:09:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 May 2014 16:09:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B1D34911324; Mon, 5 May 2014 16:09:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mmocny@apache.org To: commits@cordova.apache.org Date: Mon, 05 May 2014 16:09:14 -0000 Message-Id: <4d9be9cd371348e59a72a435e315f8f8@git.apache.org> In-Reply-To: <424589e647314319adf54effbaad4b16@git.apache.org> References: <424589e647314319adf54effbaad4b16@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [14/49] git commit: properly stop watching... properly stop watching... Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/4d202c1f Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/4d202c1f Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/4d202c1f Branch: refs/heads/cdvtest Commit: 4d202c1f0d911c4f05469724db82eb03911f2415 Parents: 470c7c6 Author: Piotr Zalewa Authored: Thu Oct 24 14:31:10 2013 +0200 Committer: Piotr Zalewa Committed: Thu Oct 24 14:31:10 2013 +0200 ---------------------------------------------------------------------- src/firefoxos/accelerometer.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/4d202c1f/src/firefoxos/accelerometer.js ---------------------------------------------------------------------- diff --git a/src/firefoxos/accelerometer.js b/src/firefoxos/accelerometer.js index 8f33c51..b01f77c 100644 --- a/src/firefoxos/accelerometer.js +++ b/src/firefoxos/accelerometer.js @@ -1,15 +1,16 @@ +function listener function(ev) { + var acc = ev.accelerationIncludingGravity; + acc.timestamp = new Date().getTime(); + success(acc); +} var Accelerometer = { start: function start(success, error) { - return window.addEventListener('devicemotion', function(ev) { - var acc = ev.accelerationIncludingGravity; - acc.timestamp = new Date().getTime(); - success(acc); - }, false); + return window.addEventListener('devicemotion', listener, false); }, stop: function stop() { - window.removeEventListener('devicemotion'); + window.removeEventListener('devicemotion', listener, false); } };