Category: Javascript
How to Add and Use New JSDoc Tag Using Plugin?
I am working with JSDoc 3.6.4 to document JavaScript library. I want to mark certain functions available for Pro version so I want to add a new JSDoc tag “@pro” to indicate that certain features available in Pro version. How to Create a New JSDoc Tag? If we want to have a new tag supported,…
FabricJS Image.applyFilters trims image
Issue When you apply filters to an image, it trims on the right or bottom part. Cause Internally by default image is painted over a tile of 2048×2048. If the height or width of the image is greater than 2048, remaining part of the image will be trimmed. Fix Increase textureSize to 4096 at the…
Get font character bounding box using opentype.js
If you would like to get the bounding box details of any font character using opentype.js, here is a working example. Dependency: JQuery Opentype.js FORTE.ttf font (or you can use any font) Make sure you make appropriate change to Url to load above mentioned resources from the following example.
How to pass string constants in UglifyJS as define argument
If you need to pass the constant number or boolean values in UglifyJS –define option, it is very easy. The tricky part is passing the string constant. Here is a quick code snippet to show how to pass string constant. The correct sequence is single quote + double quote + your string + double quote…
How To Use UglifyJS Conditional Compilation With reduce_vars
UglifyJS supports conditional compilation using the “–define” argument. Even though this option is good enough, it “looks” messy. The command prompt argument becomes too long and making an addition to the constant feels dreaded. Here is a quick way to use separate js file to define all your constants and use it in subsequent files.…
Randomize Variable Names Each Time UglifyJS Runs
Why Randomize Variable Names? If you are using UglifyJS to uglify your JavaScript code, you are using it only to serve a single purpose – to make it hard for anyone to peek into your code. But if you have minor changes to the code, variable names still come out pretty much same. So it…
How to Use JSDoc @event Tag Correctly?
I am using JSDoc 3.4.2 for my JavaScript API documentation need. By looking at the @event tag example, when I tried to use it, the event name was replaced with “event:” + event name which was a sign that it was looking at the @event tag correctly but found two issues. When I use @fire…
How to Document Self-Executing Anonymous Javascript Function Using JSDoc?
I have a class defined in self-executing anonymous Javascript function for which I want to generate the documentation using JSDoc 3.4.2 but I had hard time finding the solution. Solutions searched on the internet did not yield the fruitful result and I had to try various combination of tags in order to get it working.…
JSDoc Tokenizer Plugin to Replace the Token With Values From Config
If you are a JavaScript developer, you would have used the JSDoc to document your JavaScript code. I was trying to use the JSDoc for generating the documentation for my PramukhIME Javascript library. I have the core library and based on the plugin, I wanted to generate the documentation to show how the plugin works…
JSDoc – Customize Output Documentation Files
I am using JSDoc 3.4.2 for my JavaScript library documentation. I wanted to make the change to the output files so here are the tricks I used to make following changes. In order to make the change, I have copied all the files from the default template available at “C:\Users\USERNAME\AppData\Roaming\npm\node_modules\jsdoc\templates\default” (JSDoc over Node.js location) to…