Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Javascript List Methods
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Juxta
Senior Member

27 Posts

Posted - Mar 23 2009 :  5:59:03 PM  Show Profile  Reply with Quote
Does not work for inline object declaration.
this works.

MyObject.prototype.myFunc = function(blah){...

but this does not.


var MyObject = {
myFunc:function(blah){
},
myOtherFunc:function(blah){...
}}

this is a vary common style of declaration and it would be Great if the List Methods searched through and found any lvalue : function and listed it as a method.

Cheers.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Mar 24 2009 :  8:07:14 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=25370

For now, you can use VA Outline as a workaround:

VAssistX -> Tools -> VA Outline

You can navigate by double click and it has a lot of interesting and useful features:

http://www.wholetomato.com/products/features/vaoutline.asp

Edited by - accord on Mar 24 2009 8:13:59 PM
Go to Top of Page

Juxta
Senior Member

27 Posts

Posted - Mar 24 2009 :  8:40:52 PM  Show Profile  Reply with Quote
quote:
Originally posted by accord

I am seeing the same effect here. Thank you for the clear description.

case=25370

For now, you can use VA Outline as a workaround:

VAssistX -> Tools -> VA Outline

You can navigate by double click and it has a lot of interesting and useful features:

http://www.wholetomato.com/products/features/vaoutline.asp


Thanks for the Speedy reply
Go to Top of Page

Juxta
Senior Member

27 Posts

Posted - Mar 24 2009 :  8:49:34 PM  Show Profile  Reply with Quote
I get the same result in outline also.
Sorry.
Regarding the Dojo toolkit dojo.declare method
The class body is actually declared in a parameter of the declare function.

like

dojo.declare("dojo.rpc.RpcService", null, { 
	constructor: function(args){..}
...}


Maybe its the depth that VA is scanning.
Would be good if any :function(){ was indexed in outline and list methods.

example module.

dojo.provide("dojo.rpc.RpcService");

dojo.declare("dojo.rpc.RpcService", null, {
	constructor: function(args){
		//summary:
		//Take a string as a url to retrieve an smd or an object that is an smd or partial smd to use
		//as a definition for the service
		//
		//	args: object
		//		Takes a number of properties as kwArgs for defining the service.  It also
		//		accepts a string.  When passed a string, it is treated as a url from
		//		which it should synchronously retrieve an smd file.  Otherwise it is a kwArgs
		//		object.  It accepts serviceUrl, to manually define a url for the rpc service
		//		allowing the rpc system to be used without an smd definition. strictArgChecks
		//		forces the system to verify that the # of arguments provided in a call
		//		matches those defined in the smd.  smdString allows a developer to pass
		//		a jsonString directly, which will be converted into an object or alternatively
		//		smdObject is accepts an smdObject directly.
		//				
		if(args){
			//if the arg is a string, we assume it is a url to retrieve an smd definition from
			if( (dojo.isString(args)) || (args instanceof dojo._Url)){
				if (args instanceof dojo._Url){
					var url = args + "";
				}else{
					url = args;
				}
				var def = dojo.xhrGet({
					url: url,
					handleAs: "json-comment-optional",
					sync: true
				});
				
				def.addCallback(this, "processSmd");
				def.addErrback(function() {
					throw new Error("Unable to load SMD from " + args);
				});

			}else if(args.smdStr){
				this.processSmd(dojo.eval("("+args.smdStr+")"));
			}else{
				// otherwise we assume it's an arguments object with the following
				// (optional) properties:
				//      - serviceUrl
				//      - strictArgChecks
				//      - smdStr
				//      - smdObj

				if(args.serviceUrl){
					this.serviceUrl = args.serviceUrl;
				}

				this.timeout = args.timeout || 3000;

				if("strictArgChecks" in args){
					this.strictArgChecks = args.strictArgChecks;
				}

				this.processSmd(args);
			}
		}
	},

	strictArgChecks: true,
	serviceUrl: "",

	parseResults: function(obj){
		// summary
		// 		parse the results coming back from an rpc request.  this
		// 		base implementation, just returns the full object
		// 		subclasses should parse and only return the actual results
		//	obj: Object
		//		Object that is the return results from an rpc request
		return obj;
	},

	errorCallback: function(/* dojo.Deferred */ deferredRequestHandler){
		// summary:
		//		create callback that calls the Deferres errback method
		//	deferredRequestHandler: Deferred
		//		The deferred object handling a request.
		return function(data){
			deferredRequestHandler.errback(data.message);
		};
	},

	resultCallback: function(/* dojo.Deferred */ deferredRequestHandler){
		// summary:
		// 		create callback that calls the Deferred's callback method
		//	deferredRequestHandler: Deferred
		//		The deferred object handling a request.

		var tf = dojo.hitch(this, 
			function(obj){
				if(obj.error!=null){
					var err;
					if(typeof obj.error == 'object'){
						err = new Error(obj.error.message);
						err.code = obj.error.code;
						err.error = obj.error.error;
					}else{
						err = new Error(obj.error);
					}
					err.id = obj.id;
					err.errorObject = obj;
					deferredRequestHandler.errback(err);
				}else{
					deferredRequestHandler.callback(this.parseResults(obj)); 
				}
			}
		);
		return tf;
	},

	generateMethod: function(/*string*/ method, /*array*/ parameters, /*string*/ url){
		// summary:
		// 		generate the local bind methods for the remote object
		//	method: string
		//		The name of the method we are generating
		//	parameters: array
		//		the array of parameters for this call.
		//	url: string
		//		the service url for this call

		return dojo.hitch(this, function(){
			var deferredRequestHandler = new dojo.Deferred();

			// if params weren't specified, then we can assume it's varargs
			if( (this.strictArgChecks) &&
				(parameters != null) &&
				(arguments.length != parameters.length)
			){
				// put error stuff here, no enough params
				throw new Error("Invalid number of parameters for remote method.");
			}else{
				this.bind(method, dojo._toArray(arguments), deferredRequestHandler, url);
			}

			return deferredRequestHandler;
		});
	},

	processSmd: function(object){
		// summary:
		// 		callback method for reciept of a smd object.  Parse the smd
		// 		and generate functions based on the description
		//	object:
		//		smd object defining this service.

		if(object.methods){
			dojo.forEach(object.methods, function(m){
				if(m && m.name){
					this[m.name] = this.generateMethod(	m.name,
										m.parameters, 
										m.url||m.serviceUrl||m.serviceURL);
					if(!dojo.isFunction(this[m.name])){
						throw new Error("RpcService: Failed to create" + m.name + "()");
						/*console.debug("RpcService: Failed to create", m.name, "()");*/
					}
				}
			}, this);
		}

		this.serviceUrl = object.serviceUrl||object.serviceURL;
		this.required = object.required;
		this.smd = object;
	}
});
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Mar 25 2009 :  3:04:55 PM  Show Profile  Reply with Quote
I can see the methods using VAX 1715:

http://yfrog.com/bcvaoutlinevsjavascriptp

Is this what you expect? Which version are you using?
Go to Top of Page

Juxta
Senior Member

27 Posts

Posted - Mar 25 2009 :  6:18:13 PM  Show Profile  Reply with Quote
This is what i get.
Like the image shack thing. Useful

http://img72.imageshack.us/my.php?image=47463311.jpg


Go to Top of Page

Juxta
Senior Member

27 Posts

Posted - Mar 25 2009 :  6:20:29 PM  Show Profile  Reply with Quote
Using 1715 also.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Mar 26 2009 :  7:11:44 PM  Show Profile  Reply with Quote
Interesting. Can you please try to create a new HTML Page to see if it makes any difference?

File -> New -> File... -> General -> HTML Page

Here I've put

<script type="text/javascript">
</script>

after <body> and put your example into this script /script block.

Or can you send me a file where it happens? Maybe the context is the difference and the cause of this problem.
VA Outline is quite reliable for me in test projects, but I don't have much experience with javascript so far.
Go to Top of Page

Juxta
Senior Member

27 Posts

Posted - Mar 26 2009 :  8:51:07 PM  Show Profile  Reply with Quote
How do i send you a file?
That [code] post was the whole content of RpcService.js from the Dojo trunk.

Hope this link works http://websvn.atomiclabs.com/filedetails.php?repname=dojo-new&path=%2Ftrunk%2Fdojo%2Frpc%2FRpcService.js&sc=1

Folling your instructions and reparsing the file yielded that same result. Only the first line is shown.
See screen shot below. If it works for you i would really love to get this going. So if you have any workarounds that would be great.
BTW: My project it setup as a website project and the files a automatically include if they reside in a subfolder of the project.
Dont know if this make a difference.

Cheers

http://img72.imageshack.us/my.php?image=94753658.jpg
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18943 Posts

Posted - Apr 09 2009 :  2:14:59 PM  Show Profile  Reply with Quote
Many appologies for the delay in getting back to you about this. I am seeing the same thing you are, with the code sample you have posted.

We are currently working on:

case=21251

which is called "improve javascript support for dojo-like usage", hopefully this will help when it is finished. This code should provide a useful test, thank you for that.

zen is the art of being at one with the two'ness
Go to Top of Page

Juxta
Senior Member

27 Posts

Posted - Apr 13 2009 :  7:59:21 PM  Show Profile  Reply with Quote
Cheers
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Dec 16 2011 :  1:59:19 PM  Show Profile  Reply with Quote
case=25370 is fixed in build 1862
Go to Top of Page

Juxta
Senior Member

27 Posts

Posted - Dec 18 2011 :  6:02:19 PM  Show Profile  Reply with Quote
yaaaaaaaaaaaaaaaaaaayyyyy!
quote:
Originally posted by support

case=25370 is fixed in build 1862

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000