Updated Branches: refs/heads/master ee2c1d20c -> ad7234568
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/notification.js ---------------------------------------------------------------------- diff --git a/lib/webos/plugin/webos/notification.js b/lib/webos/plugin/webos/notification.js deleted file mode 100644 index 01b8b5e..0000000 --- a/lib/webos/plugin/webos/notification.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * 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. - * -*/ - -module.exports = { - /* - * adds a dashboard to the WebOS app - * @param {String} url - * @param {String} html - * Example: - * navigator.notification.newDashboard("dashboard.html"); - */ - newDashboard: function(url, html) { - var win = window.open(url, "_blank", "attributes={\"window\":\"dashboard\"}"); - html && win.document.write(html); - win.PalmSystem.stageReady(); - }, - - /* - * Displays a banner notification. If specified, will send your 'response' object as data via the 'palmsystem' DOM event. - * If no 'icon' filename is specified, will use a small version of your application icon. - * @param {String} message - * @param {Object} response - * @param {String} icon - * @param {String} soundClass class of the sound; supported classes are: "ringtones", "alerts", "alarm", "calendar", "notification" - * @param {String} soundFile partial or full path to the sound file - * @param {String} soundDurationMs of sound in ms - * Example: - * navigator.notification.showBanner('test message'); - */ - showBanner: function(message, response, icon, soundClass, soundFile, soundDurationMs) { - response = response || { - banner: true - }; - PalmSystem.addBannerMessage(message, JSON.stringify(response), icon, soundClass, soundFile, soundDurationMs); - }, - - /** - * Remove a banner from the banner area. The category parameter defaults to 'banner'. Will not remove - * messages that are already displayed. - * @param {String} category - Value defined by the application and usually same one used in {@link showBanner}. - It is used if you have more than one kind of banner message. - */ - removeBannerMessage: function(category) { - var bannerKey = category || 'banner'; - var bannerId = this.banners.get(bannerKey); - if (bannerId) { - try { - PalmSystem.removeBannerMessage(bannerId); - } catch(removeBannerException) { - window.debug.error(removeBannerException.toString()); - } - } - }, - - /* - * Remove all pending banner messages from the banner area. Will not remove messages that are already displayed. - */ - clearBannerMessage: function() { - PalmSystem.clearBannerMessage(); - }, - - /* - * This function vibrates the device - * @param {number} duration The duration in ms to vibrate for. - * @param {number} intensity The intensity of the vibration - */ - vibrate_private: function(duration, intensity) { - //the intensity for palm is inverted; 0=high intensity, 100=low intensity - //this is opposite from our api, so we invert - if (isNaN(intensity) || intensity > 100 || intensity <= 0) - intensity = 0; - else - intensity = 100 - intensity; - - // if the app id does not have the namespace "com.palm.", an error will be thrown here - //this.vibhandle = new Mojo.Service.Request("palm://com.palm.vibrate", { - this.vibhandle = navigator.service.Request("palm://com.palm.vibrate", { - method: 'vibrate', - parameters: { - 'period': intensity, - 'duration': duration - } - }, - false); - }, - - vibrate: function(param) { - PalmSystem.playSoundNotification('vibrate'); - }, - /* - * Plays the specified sound - * @param {String} soundClass class of the sound; supported classes are: "ringtones", "alerts", "alarm", "calendar", "notification" - * @param {String} soundFile partial or full path to the sound file - * @param {String} soundDurationMs of sound in ms - */ - beep: function(param) { - PalmSystem.playSoundNotification('alerts'); - }, - - getRootWindow: function() { - var w = window.opener || window.rootWindow || window.top || window; - if(!w.setTimeout) { // use this window as the root if we don't have access to the real root. - w = window; - } - return w; - }, - - open: function(inOpener, inUrl, inName, inAttributes, inWindowInfo) { - var url = inUrl; - var a = inAttributes && JSON.stringify(inAttributes); - a = "attributes=" + a; - var i = inWindowInfo ? inWindowInfo + ", " : ""; - return inOpener.open(url, inName, i + a); - }, - - openWindow: function(inUrl, inName, inParams, inAttributes, inWindowInfo) { - //var attributes = inAttributes || {}; - //attributes.window = attributes.window || "card"; - // NOTE: make the root window open all windows. - return this.open(this.getRootWindow(), inUrl, inName || "", inAttributes, inWindowInfo); - }, - - alert: function(message,callback,title,buttonName) { - var inAttributes = {}; - //inAttributes.window = "card"; // create card - inAttributes.window = "popupalert"; // create popup - //inAttributes.window="dashboard"; // create dashboard - var html='<html><head><script>setTimeout(function(f){var el=window.document.getElementById("b1");console.error(el);el.addEventListener("click",function(f){window.close();},false);},500);</script></head><body>'+message+'<br/><button id="b1">'+buttonName+'</button></body></html>'; - var inName="PopupAlert"; - var inUrl=""; - var inParams={}; - var inHeight=120; - var w = this.openWindow(inUrl, inName, inParams, inAttributes, "height=" + (inHeight || 200)); - w.document.write(html); - w.PalmSystem.stageReady(); - } -}; http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/orientation.js ---------------------------------------------------------------------- diff --git a/lib/webos/plugin/webos/orientation.js b/lib/webos/plugin/webos/orientation.js deleted file mode 100644 index 3c05d9b..0000000 --- a/lib/webos/plugin/webos/orientation.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * 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. - * -*/ - -module.exports = { - setOrientation: function(orientation) { - PalmSystem.setWindowOrientation(orientation); - }, - - /* - * Returns the current window orientation - * orientation is one of 'up', 'down', 'left', 'right', or 'free' - */ - getCurrentOrientation: function() { - return PalmSystem.windowOrientation; - } -}; http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/requestfilesystem.js ---------------------------------------------------------------------- diff --git a/lib/webos/plugin/webos/requestfilesystem.js b/lib/webos/plugin/webos/requestfilesystem.js deleted file mode 100644 index 82a6232..0000000 --- a/lib/webos/plugin/webos/requestfilesystem.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * 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. - * -*/ - -module.exports = function(type,size,successCallback,errorCallback) { - console.error("requestFileSystem"); - - var theFileSystem={}; - theFileSystem.name="webOS"; - theFileSystem.root={}; - theFileSystem.root.name="Root"; - - theFileSystem.root.getFile=function(filename,options,successCallback,errorCallback) { - console.error("getFile"); - if (options.create) { errorCallback(); } - var theFile=filename; - successCallback(theFile); - }; - - successCallback(theFileSystem); -}; http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/service.js ---------------------------------------------------------------------- diff --git a/lib/webos/plugin/webos/service.js b/lib/webos/plugin/webos/service.js deleted file mode 100644 index 55ad144..0000000 --- a/lib/webos/plugin/webos/service.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * 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. - * -*/ - -function Service() { } - -Service.prototype.Request = function (uri, params) { - var req = new PalmServiceBridge(); - var url = uri + "/" + (params.method || ""); - req.url = url; - - this.req = req; - this.url = url; - this.params = params || {}; - - this.call(params); - - return this; -}; - -Service.prototype.call = function(params) { - var onsuccess = null; - var onfailure = null; - var oncomplete = null; - - if (typeof params.onSuccess === 'function') - onsuccess = params.onSuccess; - - if (typeof params.onFailure === 'function') - onerror = params.onFailure; - - if (typeof params.onComplete === 'function') - oncomplete = params.onComplete; - - this.req.onservicecallback = callback; - - function callback(msg) { - var response = JSON.parse(msg); - - if ((response.errorCode) && onfailure) - onfailure(response); - else if (onsuccess) - onsuccess(response); - - if (oncomplete) - oncomplete(response); - } - - this.data = (typeof params.parameters === 'object') ? JSON.stringify(params.parameters) : '{}'; - - this.req.call(this.url, this.data); -}; - -module.exports = new Service(); http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/lib/webos/plugin/webos/window.js ---------------------------------------------------------------------- diff --git a/lib/webos/plugin/webos/window.js b/lib/webos/plugin/webos/window.js deleted file mode 100644 index dc87f55..0000000 --- a/lib/webos/plugin/webos/window.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * 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. - * -*/ - -module.exports={ - launchParams: function() { - return JSON.parse(PalmSystem.launchParams) || {}; - }, - /* - * This is a thin wrapper for 'window.open()' which optionally sets document contents to 'html', and calls 'PalmSystem.stageReady()' - * on your new card. Note that this new card will not come with your framework (if any) or anything for that matter. - * @param {String} url - * @param {String} html - * Example: - * navigator.window.newCard('about:blank', '<html><body>Hello again!</body></html>'); - */ - newCard: function(url, html) { - var win = window.open(url || ""); - if (html) - win.document.write(html); - win.PalmSystem.stageReady(); - }, - - /* - * Enable or disable full screen display (full screen removes the app menu bar and the rounded corners of the screen). - * @param {Boolean} state - * Example: - * navigator.window.setFullScreen(true); - */ - setFullScreen: function(state) { - // valid state values are: true or false - PalmSystem.enableFullScreenMode(state); - }, - - /* - * used to set the window properties of the WebOS app - * @param {Object} props - * Example: - * private method used by other member functions - ideally we shouldn't call this method - */ - setWindowProperties: function(inWindow, inProps) { - if(arguments.length==1) { - inProps = inWindow; - inWindow = window; - } - if(inWindow.PalmSystem) { - inWindow.PalmSystem.setWindowProperties(inProps); - } - }, - - /* - * Enable or disable screen timeout. When enabled, the device screen will not dim. This is useful for navigation, clocks or other "dock" apps. - * @param {Boolean} state - * Example: - * navigator.window.blockScreenTimeout(true); - */ - blockScreenTimeout: function(state) { - navigator.windowProperties.blockScreenTimeout = state; - this.setWindowProperties(); - }, - - /* - * Sets the lightbar to be a little dimmer for screen locked notifications. - * @param {Boolean} state - * Example: - * navigator.window.setSubtleLightbar(true); - */ - setSubtleLightbar: function(state) { - navigator.windowProperties.setSubtleLightbar = state; - this.setWindowProperties(); - } -}; http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/test/errgen/errgen-tests.js ---------------------------------------------------------------------- diff --git a/test/errgen/errgen-tests.js b/test/errgen/errgen-tests.js deleted file mode 100644 index bc8ad27..0000000 --- a/test/errgen/errgen-tests.js +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -document.addEventListener("deviceready", onDeviceReady, false) - -//------------------------------------------------------------------------------ -function onDeviceReady() { - // TODO: finish the tests - testAccelerometer(); - testCamera(); - // testCapture(); - testCompass(); - // testConnection(); - // testContacts(); - // testDevice(); - // testEvents(); - // testFile(); - // testGeolocation(); - // testMedia(); - // testNotification(); - // testStorage(); -} - -//------------------------------------------------------------------------------ -function getSuccessCB(api) { - return function() { - reportFailure(api + ": success callback was called") - } -} - -//------------------------------------------------------------------------------ -function getErrorCB(api) { - return function() { - reportSuccess(api + ": error callback was called") - } -} - -//------------------------------------------------------------------------------ -function testAPI(receiver, func, args) { - if (!args) args = [] - var origArgs = args - - var receiverObject = eval(receiver) - var funcObject = receiverObject[func] - - var api = receiver + "." + func - - args.unshift(getErrorCB(api)) - args.unshift(getSuccessCB(api)) - - return funcObject.apply(receiverObject, origArgs) -} - -//------------------------------------------------------------------------------ -function testAccelerometer() { - testAPI("navigator.accelerometer", "getCurrentAcceleration") -} - -//------------------------------------------------------------------------------ -function testCamera() { - testAPI("navigator.camera", "getPicture", [{ - quality: 100, - destinationType: Camera.DestinationType.FILE_URI - }]) -} - -//------------------------------------------------------------------------------ -function testCompass() { - testAPI("navigator.compass", "getCurrentHeading") -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ad723456/test/errgen/index.html ---------------------------------------------------------------------- diff --git a/test/errgen/index.html b/test/errgen/index.html deleted file mode 100644 index cee46ba..0000000 --- a/test/errgen/index.html +++ /dev/null @@ -1,75 +0,0 @@ -<!doctype html> - -<!-- - * 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. ---> - -<html> - -<!-- ======================================================================= --> -<head> -<title>cordova errgen tester</title> -<script src='../../pkg/cordova.errgen.js'></script> -<script src='./errgen-tests.js'></script> -</head> - -<!-- ======================================================================= --> -<body> -<h1>cordova errgen tester</h1> -<div id="results"> -</div> -</body> - -<!-- ======================================================================= --> -<script> -var resultsDiv = null - -function reportSuccess(message) { - reportMessage(message, 'success') -} - -function reportFailure(message) { - reportMessage(message, 'failure') -} - -function reportMessage(message, className) { - var div = document.createElement('div') - div.className = className - div.innerText = message - - if (!resultsDiv) { - resultsDiv = document.getElementById('results') - } - - resultsDiv.appendChild(div) -} -</script> - -<!-- ======================================================================= --> -<style> -.success { - color: green; -} -.failure { - color: red; -} - -</style> - -<!-- ======================================================================= --> -</html> \ No newline at end of file
