diff --git a/js/README.md b/js/README.md index 750bfc546..3e5e21abd 100644 --- a/js/README.md +++ b/js/README.md @@ -1,5 +1,29 @@ +# JS for iTop + +## File location + In order to better separate our developments from the embedded third-party libs, files should be moved in either the /components or /lib folders. -IMPORTANT: Before moving a file, we should first consider if: +IMPORTANT: Before moving a file, we should first consider if: + - The file is used in an iTop extension that should be compatible with the iTop version currently under developments -- The file is still used in iTop itself (or if we can consider removing it for clean up) \ No newline at end of file +- The file is still used in iTop itself (or if we can consider removing it for clean up) + +## Leading semicolon + +When concataining 2 files with code execution, we might have a prb. + +For example : + +``` +// file A +(A)() +// file B +(B)() +``` + +Having `(A)()(B)()` is different than `(A)();(B)();` ! + +To avoid those problems simply add a leading semicolon on all JS files containing `()` at their end. + +See https://stackoverflow.com/a/23056287 \ No newline at end of file diff --git a/js/components/dashlet/dashlet-badge.js b/js/components/dashlet/dashlet-badge.js index bf32608ce..0b6fbc5d8 100644 --- a/js/components/dashlet/dashlet-badge.js +++ b/js/components/dashlet/dashlet-badge.js @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Affero General Public License */ +; $(function () { $.widget('itop.dashlet_badge', {