added firefoxos network apis

This commit is contained in:
Herm Wong 2013-07-30 16:09:21 -07:00
parent f761170acf
commit 96b0c5d2f6
2 changed files with 38 additions and 0 deletions

View File

@ -18,6 +18,15 @@
<clobbers target="Connection" /> <clobbers target="Connection" />
</js-module> </js-module>
<!-- firefoxos -->
<platform name="firefoxos">
<config-file target="config.xml" parent="/*">
<param name="firefox-package" value="Network" />
</config-file>
<source-file src="src/firefoxos/network.js" target dir="src/firefoxos" />
</platform>
<!-- android --> <!-- android -->
<platform name="android"> <platform name="android">
<config-file target="res/xml/config.xml" parent="/*"> <config-file target="res/xml/config.xml" parent="/*">

29
src/firefoxos/network.js Normal file
View File

@ -0,0 +1,29 @@
/*
*
* 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 cordova = require('cordova');
module.exports = {
getConnectionInfo: function (win, fail, args) {
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
win(connection.bandwidth);
}
};