The Core module specifies the core EVT module and the client default settings. The library is built by adding functionality or sub-modules to EVT.

define([ 'utils' ], function (Utils) { 'use strict';

Version is updated from package.json using grunt-version on build.

var version = '4.7.2';

Setup default settings:

  • apiUrl: String - change the default API host
  • fullResponse: Boolean - by default the response of every call if the JSON body. However if you need to access the 'status' or 'responseHeaders' in responses set this to 'true'. The full response has the structure:
   data: <JSON data>,
   headers: <response headers map>
   status: <HTTP status code>
  • quiet: Boolean - set to true if you don't want EVT.js to write anything to the console
  • geolocation: Boolean - set to true to ask for Geolocation when needed
  • interceptors: Array - each interceptor implements 'request' and/or 'response' functions that run before or after each HTTP call:
 var myInterceptor = {
   request: function(options){
     // do anything with, options.headers, start spinner, etc.
     return options;
   response: function(result){
     // do anything with result, stop spinner, etc. (can return promise)
     return result;
  • timeout: Integer - set the request timeout, in ms
  • apiKey: String - set the authorization API key used for all raw requests
var defaultSettings = { apiUrl: '', fullResponse: false, quiet: false, geolocation: true, interceptors: [] };

Module definition and raw API.

var EVT = { version: version, settings: defaultSettings, Utils: Utils, Entity: {},

Setup method allows the developer to change overall settings for every subsequent request. However, these can be overridden for each request as well. Setup merges current settings with the new custom ones.

setup: function (customSettings) { if(Utils.isObject(customSettings)){ this.settings = Utils.extend(this.settings, customSettings); }else{ throw new TypeError('Setup should be called with an options object.'); } return this.settings; },

Use the passed plugin features by requiring its dependencies and installing it.

use: function (plugin){ if (Utils.isObject(plugin) && Utils.isFunction(plugin.install)) { var installArgs = [];

Inject plugin dependencies as requested, using the synchronous require API for Require.js and Almond.js.

if(plugin.$inject){ plugin.$inject.forEach(function (dependency) { installArgs.push(require(dependency)); }); } plugin.install.apply(plugin, installArgs); return this; } else { throw new TypeError('Plugin must implement \'install()\' method.'); } } }; return EVT; });