From dabf25425c2186fe691949d27dd8c0b1f2d0c1c7 Mon Sep 17 00:00:00 2001 From: Zaheer Abbas Merali Date: Sun, 29 Jul 2012 18:36:12 +0100 Subject: [PATCH] Port DatePicker to phonegap 2.0 --- Android/DatePicker/datePickerPlugin.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Android/DatePicker/datePickerPlugin.js b/Android/DatePicker/datePickerPlugin.js index 9f533f74..3bbf15eb 100644 --- a/Android/DatePicker/datePickerPlugin.js +++ b/Android/DatePicker/datePickerPlugin.js @@ -2,13 +2,15 @@ * Phonegap DatePicker Plugin Copyright (c) Greg Allen 2011 MIT Licensed * Reused and ported to Android plugin by Daniel van 't Oever */ -if (typeof cordova !== "undefined") { +cordova.define("cordova/plugin/datepicker", function(require, exports, module) { + var exec = require("cordova/exec"); + /** * Constructor */ - function DatePicker() { + var DatePicker = function() { this._callback; - } + }; /** * show - true to show the ad, false to hide the ad @@ -43,10 +45,6 @@ if (typeof cordova !== "undefined") { console.log("datePickerPlugin.js failed: " + err); } - cordova.addConstructor(function() { - if (!window.plugins) { - window.plugins = {}; - } - window.plugins.datePicker = new DatePicker(); - }); -}; + var datePicker = new DatePicker(); + module.exports = datePicker; +});