2
0
Fork 0

Disable cordova timeout by default and added factory function list

This commit is contained in:
Willem 2016-01-20 20:35:43 +01:00
parent 25e2e4bcd0
commit b30bb6c033
3 changed files with 31 additions and 16 deletions

View file

@ -71,6 +71,8 @@ A javascript library providing server defined loading of assets for a single pag
## Options ## Options
The available FFSpaLoader.options.* values;
* debug.enable = Enable debug output. (default: false) * debug.enable = Enable debug output. (default: false)
* debug.handler = Prints/log debug message. (default: console.log) * debug.handler = Prints/log debug message. (default: console.log)
* debug.prefix = Debug message prefix. (default: 'FFSpaLoader.') * debug.prefix = Debug message prefix. (default: 'FFSpaLoader.')
@ -78,7 +80,7 @@ A javascript library providing server defined loading of assets for a single pag
* error.title = The error title. (default: 'Loader Error'); * error.title = The error title. (default: 'Loader Error');
* error.style = The error ui css style. (default: red border box) * error.style = The error ui css style. (default: red border box)
* boot.cordova.enable = Use deviceready event to boot when cordova is detected. (default: true) * boot.cordova.enable = Use deviceready event to boot when cordova is detected. (default: true)
* boot.cordova.timeout = Boot after timeout when deviceready event is not received. (default: 4096) * boot.cordova.timeout = Boot after (if<0=no-)timeout when deviceready event is not received. (default: -1)
* boot.cordova.flag = The window flag which is set when cordova is booted. (default: 'FFCordovaDevice') * boot.cordova.flag = The window flag which is set when cordova is booted. (default: 'FFCordovaDevice')
* boot.angular.enable = Auto bootstrap angular modules. (default: true) * boot.angular.enable = Auto bootstrap angular modules. (default: true)
* boot.angular.modules = The angular modules to boot. (default: empty) * boot.angular.modules = The angular modules to boot. (default: empty)
@ -95,6 +97,19 @@ A javascript library providing server defined loading of assets for a single pag
* cache.css = The cache backend for for css, null is auto select. (default: null) * cache.css = The cache backend for for css, null is auto select. (default: null)
* cache.cssData = The cache backend for for cssData, null is auto select. (default: null) * cache.cssData = The cache backend for for cssData, null is auto select. (default: null)
## Factory
The available FFSpaLoader.factory.* functions;
* detect.localStorage() = Checks is localStorage is working.
* detect.openDatabase() = Checks if openDatabase is defined.
* detect.sqlitePlugin() = Checks if sqlitePlugin is defined.
* detect.cordova() = Checks if cordova is defined.
* detect.cordovaDevice() = Checks if cordovaDevive window flag is defined which will be set by the buildin cordova boot code.
* cache.localStorage() = Creates an localStorage service.
* cache.websql(opt) = Creates an websql service.
## Cache Config ## Cache Config
Per default all cache type as in auto select mode which detect and used the following; Per default all cache type as in auto select mode which detect and used the following;
@ -136,6 +151,7 @@ A javascript library providing server defined loading of assets for a single pag
* test in production * test in production
* Server header set+check support * Server header set+check support
* Redo css(?divs) of server question * Redo css(?divs) of server question
* Add table+instance websql options so it can also be used in application code.
* Add more tests * Add more tests
* css: set tag.media = 'only you'; * css: set tag.media = 'only you';
* css: add media in resouces * css: add media in resouces
@ -148,11 +164,16 @@ Add unit tests for any new or changed functionality. Lint and test your code.
## Release History ## Release History
### 0.0.4
* Disable cordova timeout per default.
* Remove unused mobileAgent detect.
### 0.0.3 ### 0.0.3
* Fix script path in example * Fixed example script path.
### 0.0.2 ### 0.0.2
* Limited example size * Fixed example size.
### 0.0.1 ### 0.0.1
* Initial release * Initial release.

View file

@ -55,7 +55,7 @@
boot: { boot: {
cordova: { cordova: {
enable: true, enable: true,
timeout: 4096, // FIXME: Test really slow devices -> increase ? or add support -1 for disable or ? timeout: -1,
flag: 'FFCordovaDevice' flag: 'FFCordovaDevice'
}, },
angular: { angular: {
@ -115,9 +115,6 @@
}, },
cordovaDevice: function() { cordovaDevice: function() {
return options.boot.cordova.flag in rootWindow; return options.boot.cordova.flag in rootWindow;
},
mobileAgent: function() {
return rootWindow.navigator !== undefined && rootWindow.navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/);
} }
}, },
cache: { cache: {
@ -265,8 +262,8 @@
var rootTag = document.createElement('div'); var rootTag = document.createElement('div');
rootTag.setAttribute('class','ffError'); rootTag.setAttribute('class','ffError');
var cssTag = document.createElement("style"); var cssTag = document.createElement('style');
cssTag.type = "text/css"; cssTag.type = 'text/css';
cssTag.innerHTML = options.error.style; cssTag.innerHTML = options.error.style;
rootTag.appendChild(cssTag); rootTag.appendChild(cssTag);
@ -596,8 +593,8 @@
var rootTag = document.createElement('div'); var rootTag = document.createElement('div');
rootTag.setAttribute('class','ffAskUrl'); rootTag.setAttribute('class','ffAskUrl');
var cssTag = document.createElement("style"); var cssTag = document.createElement('style');
cssTag.type = "text/css"; cssTag.type = 'text/css';
cssTag.innerHTML = options.server.question.style; cssTag.innerHTML = options.server.question.style;
rootTag.appendChild(cssTag); rootTag.appendChild(cssTag);
@ -791,7 +788,7 @@
bootOnce(); bootOnce();
}, options.boot.cordova.timeout); }, options.boot.cordova.timeout);
} }
document.addEventListener("deviceready", function () { document.addEventListener('deviceready', function () {
rootWindow[options.boot.cordova.flag] = true; rootWindow[options.boot.cordova.flag] = true;
utilDebug('bootCordova '+options.boot.cordova.flag); utilDebug('bootCordova '+options.boot.cordova.flag);
bootOnce(); bootOnce();

View file

@ -19,8 +19,5 @@ describe('Check factory detect', function() {
it('FFSpaLoader.factory.detect.cordovaDevice', function() { it('FFSpaLoader.factory.detect.cordovaDevice', function() {
assert.equal(false, FFSpaLoader.factory.detect.cordovaDevice()); assert.equal(false, FFSpaLoader.factory.detect.cordovaDevice());
}); });
it('FFSpaLoader.factory.detect.mobileAgent', function() {
assert.equal(false, FFSpaLoader.factory.detect.mobileAgent());
});
}); });