You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by bb...@apache.org on 2006/11/02 22:13:53 UTC

svn commit: r470549 - /incubator/xap/trunk/src/xap/util/Debug.js

Author: bbuffone
Date: Thu Nov  2 14:13:52 2006
New Revision: 470549

URL: http://svn.apache.org/viewvc?view=rev&rev=470549
Log:
I have updated the starting process of the XAP engine with the HTML page.
This changes is defined in emails from me on the 8/29.  
This changes break compatibilty with existing samples. 
To see how the new process works check out the new samples in 
the startup folder.

Added:
    incubator/xap/trunk/src/xap/util/Debug.js

Added: incubator/xap/trunk/src/xap/util/Debug.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/Debug.js?view=auto&rev=470549
==============================================================================
--- incubator/xap/trunk/src/xap/util/Debug.js (added)
+++ incubator/xap/trunk/src/xap/util/Debug.js Thu Nov  2 14:13:52 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright  2006 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+ 
+ /**
+ * This call handles all the debugging functionality to load the
+ * Javascript files that aren't compressed.  Makes it easier to 
+ * debug.
+ * 
+ * @author bbuffone
+ */
+
+Xap.provide("xap.util.Debug");
+Xap.require("xap.util.Utils");
+
+
+xap.util.Debug._sourceRootDir = "../../";
+
+/**
+ *  Keep track of the source root directory for the debuggable files.
+ */
+xap.util.Debug.setSourceRootDir = function(srcDir){
+	xap.util.Debug._sourceRootDir = srcDir;
+}
+
+/**
+ * Add the array of debuggable files to the current list.
+ */
+xap.util.Debug.addDebuggables = function(debuggables){
+	if( !xap.util.Debug._debuggables ){
+		xap.util.Debug._debuggables = new Object() ;
+	}
+	for (var ii=0; ii<arguments.length; ++ii ){
+		xap.util.Debug._debuggables[arguments[ii]] = true ; 
+	}
+}
+
+/**
+ * Load the list of debuggable file from the server.
+ */
+xap.util.Debug.loadDebuggables = function(pathHolderObj){
+	if(!pathHolderObj){
+		xap.util.Debug.loadDebuggables(xap.util.Debug._debuggables) ;
+		return;
+	}else{ 
+		for (var nom in pathHolderObj){
+			xap.util.Debug._loadDebuggable(nom) ;
+		}
+	}
+}
+
+/**
+ *  PRIVATE METHODS AND VARAIABLES
+ */
+ 
+// We use these repeatedly, why re-create them each time?
+xap.util.Debug.trailingSlashRegexp = /^.*\/$/ ;
+xap.util.Debug.allFullstopsRegexp = /\./g ;
+xap.util.Debug.anyAsteriskRegexp = /\*/g ;
+
+xap.util.Debug._loadDebuggable = function(str){
+	var path = str.replace(xap.util.Debug.allFullstopsRegexp,"/") ;
+	if ( !xap.util.Debug._sourceRootDir.match(xap.util.Debug.trailingSlashRegexp)){
+		xap.util.Debug._sourceRootDir +="/" ;
+	}
+	path = xap.util.Debug._sourceRootDir +"src/"+path +".js" ;
+	xap.util.Utils.importFile(path) ;
+}