renamed routing.js,

encapsulated local helper functions in OSRM.base
This commit is contained in:
DennisSchiefer 2012-03-28 14:30:26 +01:00
parent 71426cf760
commit c5bd2b0b1d
3 changed files with 9 additions and 6 deletions

View File

@ -28,17 +28,20 @@ OSRM.G = OSRM.GLOBALS; // abbreviations
OSRM.C = OSRM.CONSTANTS;
// [convenience function] declare one class to be a subclass of another class
OSRM._inheritFromHelper = function() {};
// declare one class to be a subclass of another class
// (runs anonymous function to prevent local functions cluttering global namespace)
(function() {
var _inheritFromHelper = function() {};
OSRM.inheritFrom = function( sub_class, base_class ) {
OSRM._inheritFromHelper.prototype = base_class.prototype;
sub_class.prototype = new OSRM._inheritFromHelper();
_inheritFromHelper.prototype = base_class.prototype;
sub_class.prototype = new _inheritFromHelper();
sub_class.prototype.constructor = sub_class;
sub_class.prototype.base = base_class.prototype;
};
}());
// [convenience function] extend prototypes of a class -> used to add member values and functions
// extend prototypes of a class -> used to add member values and functions
OSRM.extend = function( target_class, properties ) {
for( property in properties ) {
target_class.prototype[property] = properties[property];

View File

@ -56,7 +56,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
<script src="OSRM.Geocoder.js" type="text/javascript"></script>
<script src="main.js" type="text/javascript"></script>
<script src="routing.js" type="text/javascript"></script>
<script src="OSRM.Routing.js" type="text/javascript"></script>
<script src="OSRM.Via.js" type="text/javascript"></script>
<script src="OSRM.Utils.js" type="text/javascript"></script>