Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using Requirejs in Javascript

Thread Tools

Using Requirejs in Javascript

sshankaran sshankaran is offline
Junior Member
Join Date: Feb 2011
Posts: 1

I am using requirejs in my js files.
If I have 3 pages and each page depends on more than one js files.For each page I have a master js file and in that I am specifying the other scripts to be loaded.
For Example:

Master1.js will have
define(["abc","jquery-pubsub","x"],function(){ Here I will write my code}

Master2.js will have
define(["xyz","jquery-ElementValidator","y"],function(){ Here I will write my code}

Master3.js will have
define(["wpx","jquery-Printelement","dff"],function(){ Here I will write my code}

My Question is

I want to centralize the code where in all the define() are placed, so that I can avoid each developer doing that page, worry about the order and what scripts to be loaded. I have any new scripts, I can just go the central location and add the scripts pertinent to the page.

Ex: If I have a master page, I should be able specify the scripts to be loaded for each page when the page is loaded, instead of loading all the scripts at time.

Any idea is highly appreciated,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript to Validate the Phone Number Field Using Javascript :-) Abhishek Javascript 5 08-07-2008 09:14 AM
dynamic javascript and html using javascript parez Javascript 0 09-11-2007 04:08 PM
Re: using css in html embedded in xml rendered using xsl with javascript (phew) confused XML 3 05-28-2007 11:55 AM
using css in html embedded in xml rendered using xsl with javascript (phew) confused XML 3 05-25-2007 11:06 PM
Extract links from Javascript (not using Javascript)? Javascript 8 05-30-2006 08:46 AM