function success(){
// If a local callback was specified, fire it and pass it the data
if ( s.success )
s.success( data, status );
// Fire the global callback
if ( s.global )
jQuery.event.trigger( "ajaxSuccess", [xhr, s] );
}
function complete(){
// Process result
if ( s.complete )
s.complete(xhr, status);
// The request was completed
if ( s.global )
jQuery.event.trigger( "ajaxComplete", [xhr, s] );
// Handle the global AJAX counter
if ( s.global && ! --jQuery.active )
jQuery.event.trigger( "ajaxStop" );
}
Code language: JavaScript (javascript)
and following is what JSMin gave me after removing unnecessary spaces and comments. function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}
Code language: JavaScript (javascript)
Almost 55% of compression achieved. :) Other tools available in similar lines are: YUI Compressor Dojo Toolkit’s ShrinkSafe Dean Edward’s Packer Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
Good site on cool technologies.!!
Good points on minifying.
We recently did this on our intranet web applications. We did it using jsmin.
While the compression was good (about 50%), it made little impact on the load time of the page for users. Why? Because the amount of in-house javascript the we were now minifying was dwarfed by the amount of 3rd-party javascript (dojo, ArcGIS Server Javascript API, TinyMCE, FCKEditor, etc.), which were already pre-minified.
That's not to say don't use minification on your web sites. We do. But you may want to evaluate beforehand, what percentage of the code used by my web can I actually minify? Ten percent? If my user sees a 5% speed improvement, will that make the effort worthwhile for me?
@Lars,
I guess even if they see a 1% of improvement, it is worth your time. We are getting into an era where users and customers become the most important thing since we make business from them. That is why I believe that if a thousand users see 1% improvement, it is worth one hour of your time, plust the fact that now you can minify all php code, html, css and javascript, which at the end causes a considerable effect.
That's my thought tho....
Regards
thank you for sharing. I've update my website using your tricks.