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 C7256106C2 for ; Thu, 26 Sep 2013 22:25:31 +0000 (UTC) Received: (qmail 18778 invoked by uid 500); 26 Sep 2013 22:25:31 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 18734 invoked by uid 500); 26 Sep 2013 22:25:31 -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 18547 invoked by uid 99); 26 Sep 2013 22:25:30 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Sep 2013 22:25:30 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 192BA90B717; Thu, 26 Sep 2013 22:25:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: steven@apache.org To: commits@cordova.apache.org Date: Thu, 26 Sep 2013 22:25:31 -0000 Message-Id: <114b74fb31d14277a808c60e7621fc1b@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [02/10] git commit: [CB-4592] [Blackberry10] Added beep support [CB-4592] [Blackberry10] Added beep support Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/888a12ba Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/888a12ba Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/888a12ba Branch: refs/heads/master Commit: 888a12ba3d54b6c64d75d6147fbf4d8f30c791d3 Parents: f26bc04 Author: Kristoffer Flores Authored: Fri Aug 23 14:14:42 2013 -0400 Committer: Bryan Higgins Committed: Fri Sep 13 08:42:40 2013 -0400 ---------------------------------------------------------------------- plugin.xml | 11 +++++++---- src/blackberry10/index.js | 4 ---- www/blackberry10/beep.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/888a12ba/plugin.xml ---------------------------------------------------------------------- diff --git a/plugin.xml b/plugin.xml index fb3184d..7cfabbf 100644 --- a/plugin.xml +++ b/plugin.xml @@ -20,18 +20,18 @@ - + - + - + @@ -40,7 +40,7 @@ - + @@ -49,6 +49,9 @@ + + + http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/888a12ba/src/blackberry10/index.js ---------------------------------------------------------------------- diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js index fad04f7..b218eab 100644 --- a/src/blackberry10/index.js +++ b/src/blackberry10/index.js @@ -83,9 +83,5 @@ module.exports = { } else { showDialog(args, "JavaScriptPrompt", result); } - }, - beep: function (success, fail, args, env) { - var result = new PluginResult(args, env); - result.error("Beep not supported"); } }; http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/888a12ba/www/blackberry10/beep.js ---------------------------------------------------------------------- diff --git a/www/blackberry10/beep.js b/www/blackberry10/beep.js new file mode 100644 index 0000000..6d4a77a --- /dev/null +++ b/www/blackberry10/beep.js @@ -0,0 +1,42 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ +var beep, + count = 0, + beepObj = new Audio('file:///usr/share/sounds/notification_text_message_im_received.wav'); + +beep = function (quantity) { + var callback = function () { + if (--count > 0) { + beepObj.play(); + } else { + beepObj.removeEventListener("ended", callback); + delete beepObj; + } + }; + + count += quantity; + if (count === quantity) { + beepObj.addEventListener("ended", callback); + beepObj.play(); + } +}; + +module.exports = beep;