You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/07/30 03:27:23 UTC
git commit: [Windows8] added windows8 support
Updated Branches:
refs/heads/master 96c52b4d8 -> 65372d17e
[Windows8] added windows8 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/65372d17
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/65372d17
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/65372d17
Branch: refs/heads/master
Commit: 65372d17e25522bc5f13fedaee1cd7190582192f
Parents: 96c52b4
Author: purplecabbage <pu...@gmail.com>
Authored: Mon Jul 29 18:27:07 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Mon Jul 29 18:27:07 2013 -0700
----------------------------------------------------------------------
plugin.xml | 7 ++
src/windows8/NotificationProxy.js | 117 +++++++++++++++++++++++++++++++++
2 files changed, 124 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/65372d17/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index cac0f59..087c0af 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -76,4 +76,11 @@
<source-file src="src/wp/notification-beep.wav" />
</platform>
+ <!-- windows8 -->
+ <platform name="windows8">
+ <js-module src="src/windows8/NotificationProxy.js" name="NotificationProxy">
+ <merges target="" />
+ </js-module>
+ </platform>
+
</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/65372d17/src/windows8/NotificationProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/NotificationProxy.js b/src/windows8/NotificationProxy.js
new file mode 100644
index 0000000..8ede490
--- /dev/null
+++ b/src/windows8/NotificationProxy.js
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+/*global Windows:true */
+
+var cordova = require('cordova');
+
+var isAlertShowing = false;
+var alertStack = [];
+
+module.exports = {
+ alert:function(win, loseX, args) {
+
+ if (isAlertShowing) {
+ var later = function () {
+ module.exports.alert(win, loseX, args);
+ };
+ alertStack.push(later);
+ return;
+ }
+ isAlertShowing = true;
+
+ var message = args[0];
+ var _title = args[1];
+ var _buttonLabel = args[2];
+
+ var md = new Windows.UI.Popups.MessageDialog(message, _title);
+ md.commands.append(new Windows.UI.Popups.UICommand(_buttonLabel));
+ md.showAsync().then(function() {
+ isAlertShowing = false;
+ win && win();
+
+ if (alertStack.length) {
+ setTimeout(alertStack.shift(), 0);
+ }
+
+ });
+ },
+
+ confirm:function(win, loseX, args) {
+
+ if (isAlertShowing) {
+ var later = function () {
+ module.exports.confirm(win, loseX, args);
+ };
+ alertStack.push(later);
+ return;
+ }
+
+ isAlertShowing = true;
+
+ var message = args[0];
+ var _title = args[1];
+ var _buttonLabels = args[2];
+
+ var btnList = [];
+ function commandHandler (command) {
+ win && win(btnList[command.label]);
+ }
+
+ var md = new Windows.UI.Popups.MessageDialog(message, _title);
+ var button = _buttonLabels.split(',');
+
+ for (var i = 0; i<button.length; i++) {
+ btnList[button[i]] = i+1;
+ md.commands.append(new Windows.UI.Popups.UICommand(button[i],commandHandler));
+ }
+ md.showAsync().then(function() {
+ isAlertShowing = false;
+ if (alertStack.length) {
+ setTimeout(alertStack.shift(), 0);
+ }
+
+ });
+ },
+
+ beep:function(winX, loseX, args) {
+ var count = args[0];
+ /*
+ var src = //filepath//
+ var playTime = 500; // ms
+ var quietTime = 1000; // ms
+ var media = new Media(src, function(){});
+ var hit = 1;
+ var intervalId = window.setInterval( function () {
+ media.play();
+ sleep(playTime);
+ media.stop();
+ media.seekTo(0);
+ if (hit < count) {
+ hit++;
+ } else {
+ window.clearInterval(intervalId);
+ }
+ }, playTime + quietTime); */
+ }
+};
+
+require("cordova/commandProxy").add("Notification",module.exports);
\ No newline at end of file