2
0
Fork 0

Fixed askUrl.urlTransport and updated readme a but

This commit is contained in:
Willem 2016-01-15 00:59:00 +01:00
parent 838714aac1
commit ec4e9a0dae
3 changed files with 39 additions and 15 deletions

View file

@ -1,31 +1,55 @@
es5-ff-spa-loader
=========
A javascript library providing server defined loading of resouces for a single page application.
A javascript library providing server defined loading of resources for a single page application.
## Installation
Use the es5-ff-spa-loader.js in header as script resource or inline in body.
npm --save install es5-ff-spa-loader (TODO)
## Usage
Then use the es5-ff-spa-loader.js in header as script resource or inline in body.
On index.html
## Usage Mobile
FFSpaLoader.start(...);
Single index.html
FFSpaLoader.options.debug = true;
FFSpaLoader.options.server.url = 'http://myserver';
FFSpaLoader.options.server.urlPath = '/api/path/to/spa/client/resources';
FFSpaLoader.bootDevice(function() {
FFSpaLoader.options.cache.factory = FFSpaLoader.autoSelectCache();// need deviceready via bootDevice for sqllite.
FFSpaLoader.start(function() {
console.log('FFExample.bootstrap angular');
angular.bootstrap( $('body'), ['exampleUI']);
});
});
## Usage Web
Single index.html
FFSpaLoader.options.debug = true;
FFSpaLoader.options.server.url = '';
FFSpaLoader.options.server.urlPath = '/api/path/to/spa/client/resources';
FFSpaLoader.options.cache.factory = FFSpaLoader.autoSelectCache();
FFSpaLoader.start(function() {
console.log('FFExample.bootstrap angular');
angular.bootstrap( $('body'), ['exampleUI']);
});
## Usage Multi Server
Leave out the 'FFSpaLoader.options.server.url' option then the user will be promted to input
the server on first boot.
## Options
* url = The url to fetch resources list from.
* debug = Enable console debug output.
* cachePrefix = The cache key prefix. (default: 'sync-')
* cacheGetFn = example; 'function(key) {return localStorage.getItem(key);}'
* cacheSetFn = example; 'function(key,value) {localStorage.setItem(key,value);}'
* cacheDelFn = example; 'function(key) {return localStorage.removeItem(key);}'
* options.debug = Enable console debug output.
## Example Application
There is a fully working express example application in the example folder.
todo
## Contributing

View file

@ -595,10 +595,10 @@ var FFSpaLoader = (/** @lends module:FFSpaLoader */function () {
var formTag = document.createElement('div');
rootTag.appendChild(formTag);
if (options.urlTransport !== undefined) {
if (options.askUrl.urlTransport !== undefined) {
var transportTag = document.createElement('label');
rootTag.setAttribute('for','serverInput');
transportTag.appendChild(document.createTextNode(options.urlTransport));
transportTag.appendChild(document.createTextNode(options.askUrl.urlTransport));
formTag.appendChild(transportTag);
}
var inputTag = document.createElement('input');

View file

@ -9,7 +9,7 @@ var cors = require('cors');
var morgan = require('morgan')
// example options;
var serverUrl = 'http://10.11.12.216:8080';
var serverUrl = 'http://localhost:8080';
var useInline = true; // or false
var clientResourcesWeb = [];