added OSRM.CONSTANTS, OSRM.GLOBALS for better structuring,
improved comments in OSRM.base.js and OSRM.config.js
This commit is contained in:
parent
9567a7e38c
commit
9adb590ce7
@ -16,13 +16,16 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// OSRM base class
|
// OSRM base class
|
||||||
// [has to loaded before all other OSRM classes]
|
// [has to be loaded before all other OSRM classes]
|
||||||
|
|
||||||
OSRM = {};
|
var OSRM = {};
|
||||||
OSRM.VERSION = '0.1.1';
|
OSRM.VERSION = '0.1.1';
|
||||||
|
OSRM.CONSTANTS = {};
|
||||||
|
OSRM.DEFAULTS = {};
|
||||||
|
OSRM.GLOBALS = {};
|
||||||
|
|
||||||
|
|
||||||
// inheritance helper function (convenience function)
|
// [convenience function] declare one class to be a subclass of another class
|
||||||
OSRM._inheritFromHelper = function() {};
|
OSRM._inheritFromHelper = function() {};
|
||||||
OSRM.inheritFrom = function( sub_class, base_class ) {
|
OSRM.inheritFrom = function( sub_class, base_class ) {
|
||||||
OSRM._inheritFromHelper.prototype = base_class.prototype;
|
OSRM._inheritFromHelper.prototype = base_class.prototype;
|
||||||
@ -32,7 +35,7 @@ OSRM.inheritFrom = function( sub_class, base_class ) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// class prototype extending helper function (convenience function)
|
// [convenience function] extend prototypes of a class -> used to add member values and functions
|
||||||
OSRM.extend = function( target_class, properties ) {
|
OSRM.extend = function( target_class, properties ) {
|
||||||
for( property in properties ) {
|
for( property in properties ) {
|
||||||
target_class.prototype[property] = properties[property];
|
target_class.prototype[property] = properties[property];
|
||||||
@ -40,7 +43,7 @@ OSRM.extend = function( target_class, properties ) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// usage:
|
// [usage of convenience functions]
|
||||||
// SubClass = function() {
|
// SubClass = function() {
|
||||||
// SubClass.prototype.base.constructor.apply(this, arguments);
|
// SubClass.prototype.base.constructor.apply(this, arguments);
|
||||||
// }
|
// }
|
||||||
|
@ -21,7 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
OSRM.DEFAULTS = {
|
OSRM.DEFAULTS = {
|
||||||
HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute',
|
HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute',
|
||||||
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/',
|
||||||
WEBSITE_URL: document.URL.replace(/#*\?.*/i,""),
|
WEBSITE_URL: document.URL.replace(/#*(\?.*|$)/i,""), // truncates URL before first ?, and removes tailing #
|
||||||
JSONP_TIMEOUT: 5000,
|
JSONP_TIMEOUT: 5000,
|
||||||
ZOOM_LEVEL: 14,
|
ZOOM_LEVEL: 14,
|
||||||
ONLOAD_LATITUDE: 48.84,
|
ONLOAD_LATITUDE: 48.84,
|
||||||
|
Loading…
Reference in New Issue
Block a user