IntelliSense VS08 within private closure

by jerone 17. July 2009 23:19

I love the VS08 Javascript IntelliSense; it's fast, useful and informative in combination with VSDoc.
The only bug I stumble up every time I code, is the IntelliSense within a private closure. I'll give an example of what I mean:

(function($) {  // private closure;
$(function() {
// do stuff;
});
})(jQuery);

The problem with above code is that the argument $ in the function isn't given the data from the variable jQuery. So the advantage of IntelliSense within the closure is totally lost.

But yesterday I come up with a solution for all server-side scriptwriters (in this case ASP.net) that works in 2 ways; usefulness and source.
The solution is useful in the way that it should add IntelliSense for the arguments with the least amount of code.
The other way is that it I don't want the solution to be seen in the page source. I like my source clean and informative.

So here's the solution:

(function($) {  // private closure;  <% /*debug*/ if (false) { %> 
$ = jQuery;
// <% } /*end debug*/ %>
$(function() {
// do stuff
});
})(jQuery);

The part that adds the IntelliSense is the $ = jQuery;. But the important part is the if (false) {. This causes the code to work while developing, but not to print it on the source.

After fixing these problems another problem raises. You can't add server-side inside Javascript, causes an error, which then stops the IntelliSense again. The solution for this problem was to put the server-side code in a Javascript comment. That easy and the server-side code still executes.

I hope other find this useful too, gr J

Tags: , , ,

C# | ASP.net | JavaScript | jQuery

Comments

12/15/2010 3:02:23 PM #

payday loans same day all on line

very good info, thanks

payday loans same day all on line Egypt | Reply

12/15/2010 5:14:04 PM #

student loans no credit check

The blog is very good one. I like the design of the website

student loans no credit check Ukraine | Reply

12/15/2010 6:41:45 PM #

fast cash loan arkansas

excellent article, I just gave link to it to a friend, he doing a little amount of investigation on this matter

fast cash loan arkansas Azerbaijan | Reply

12/15/2010 11:12:22 PM #

{payday loans bad credit cash in the same day

This blog is amazing one. I like the design of the blog

{payday loans bad credit cash in the same day Australia | Reply

12/16/2010 12:26:20 AM #

payday installment loans in Arizona

Big Thanks for the info! RSS feed added

payday installment loans in Arizona Denmark | Reply

12/16/2010 2:58:49 AM #

90 day payday loans in Mississippi

90 day payday loans in Mississippi Nicaragua | Reply

12/16/2010 10:45:14 AM #

faxless payday loan companies

ery nice post!

faxless payday loan companies Korea | Reply

12/17/2010 3:15:26 AM #

cash fast loan minnesota

excellent article. Subscribed to RSS

cash fast loan minnesota Slovenia | Reply

12/17/2010 5:35:51 AM #

bad credit instant cash loan

good post. Subscribed to RSS

bad credit instant cash loan Peru | Reply

12/17/2010 5:45:53 PM #

search payday loans in South Carolina

Big Thanks for the article! RSS feed added

search payday loans in South Carolina Mexico | Reply

12/17/2010 5:56:52 PM #

emergency cash advance payday loans

excellent post. Subscribed to RSS

emergency cash advance payday loans Nicaragua | Reply

12/17/2010 7:56:01 PM #

no teletrack faxless payday loans in Colorado

ery cool articleSmile

no teletrack faxless payday loans in Colorado New Zealand | Reply

12/17/2010 9:05:26 PM #

one hour payday loans in Nebraska

amazing looking site really...

one hour payday loans in Nebraska Paraguay | Reply

1/6/2011 2:11:26 PM #

loan quick signature

The blog is excellent one. I like the theme of the blog

loan quick signature Republic of the Philippines | Reply

1/7/2011 12:23:15 AM #

no credit check payday loans in Nevada

good read, I just passed this to a friend that was doing a small amount of investigation on this point

no credit check payday loans in Nevada Estonia | Reply

Add comment




  Country flag

biuquotelink
  • Comment
  • Preview
Loading



Tag cloud

This will be shown to users with no Flash or Javascript.

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar