Thread:Talk:ResourceLoader/Default modules/mw.Api (2)/reply

The class is a wrapper around $.ajax. However, one of the pieces of functionality it adds is being able to store options that apply to all requests using the object (unless overridden by the individual request). See https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Api. Your example above is not using new for side effects. In fact, the constructor really doesn't have side effects. It creates a mw.Api object, but to use that object for a network request, you need to call further methods (which the example above does).