]> git.proxmox.com Git - extjs.git/blob - extjs/packages/legacy/modern/src/device/connection/Cordova.js
add extjs 6.0.1 sources
[extjs.git] / extjs / packages / legacy / modern / src / device / connection / Cordova.js
1 /**
2 * @private
3 */
4 Ext.define('Ext.device.connection.Cordova', {
5 alternateClassName: 'Ext.device.connection.PhoneGap',
6 extend: 'Ext.device.connection.Abstract',
7
8 constructor: function() {
9 var me = this;
10
11 document.addEventListener('online', function() {
12 me.fireEvent('online', me);
13 });
14
15 document.addEventListener('offline', function() {
16 me.fireEvent('offline', me);
17 });
18 },
19
20 syncOnline: function() {
21 var type = navigator.connection.type;
22 this._type = type;
23 this._online = type != Connection.NONE;
24 },
25
26 getOnline: function() {
27 this.syncOnline();
28 return this._online;
29 },
30
31 getType: function() {
32 this.syncOnline();
33 return this._type;
34 }
35 });