I have developed a small widget library of Chart controls and wondering if there is a best practice approach to version or meta tag my JS files so that when I bring out a new release, the version checking code would take care of compatibility across new and older versions. To begin with I need to record the current version somewhere. Any suggestions? I'ven't yet looked at how JQ identifies itself...would it be only the filename?
-
1Do you plan on using some sort of loader or sticking with normal script tags?Jeff Beck– Jeff Beck2011-02-16 15:02:30 +00:00Commented Feb 16, 2011 at 15:02
-
@Jeff Beck yes using Loader is the preferrd approach!Abhijit– Abhijit2011-02-16 15:15:34 +00:00Commented Feb 16, 2011 at 15:15
Add a comment
|
2 Answers
If you are using a loader you will need to maintain the loader itself I would look at the way google deals with loading JS. It allows the user to select major minor or point release specificity to a library.
Comments
for version maintainence, this should do.
myLibrary.version = {
major : 1,
minor : 4,
datetime : "20110225223456",
toString : function () {
return this.major+ "." + this.minor;
}
}
and for loader mechanism, I found this is nice place to begin with ..http://ajaxian.com/archives/modulesjs-a-new-stand-alone-javascript-module-loader or in particular http://requirejs.org/ useful.
And something I just came across.. http://labjs.com/