jComponent / 02. Library
Updated: 27. November 2018
Author: Peter Širka

02. Library

Professional Support Chat with contributors

Quick navigation:

Properties


Property: MAIN.components

readonly Gets all instances of components.

MAIN.components;
// returns {Array Object}

Property: MAIN.defaults

Gets default settings. With this property you can change behaviour of jComponent library.

MAIN.defaults;
// returns {Object}

DEF;
// returns {Object}
// Is an alias for MAIN.defaults

DEF.ajaxerrors = false;
// {Boolean} AJAX() method won't create an exception if HTTP status code will be >= 400

DEF.baseurl = '';
// This property affects a relative URL address in AJAX requests
// {String} If it contains "string" then the string is combined with URL: "url = baseurl + url"
// {Function(url)} If it contains "function" then the function needs to return a new url
// +v13.0.5

DEF.makerurl = function(url) {
   return url;
};
// This delegate can affect URL before is request created.
// It must return updated URL!!!
// +v14.3.1

DEF.dateformat = null;
// {String} A default date format
// It's used when "new Date().format(null)" contains "null" value

DEF.decimalseparator = '.';
// Default decimal separator

DEF.delay = 300;
// {Number} A delay for real-time keypress binding

DEF.delaybinder = 200;
// {Number} A default delay for binding of value for non-released component
// +v13.0.0

DEF.delaywatcher = 555;
// {Number} A delay for component watcher (component.width(), component.heigth(), etc.)
// +v13.0.0

DEF.devices = { xs: { max: 768 }, sm: { min: 768, max: 992 }, md: { min: 992, max: 1200 }, lg: { min: 1200 }};
// {Object} Custom display sizes for Responsive UI

DEF.fallback = 'https://cdn.componentator.com/j-{0}.html';
// {String} A fallback URL for non-exist components
// Import "fallback" will be disabled if the "fallback" will be empty
// +v14.0.0

DEF.fallbackcache = '5 minutes';
// {String} Fallback cache, empty value disables caching
// Default: empty
// +v14.0.0

DEF.headers = { 'X-Requested-With': 'XMLHttpRequest' };
// {Object} Custom AJAX() headers
// IMPORATNT: +v13.0.0 X-Requested-With is removed for CORS request

DEF.jsoncompress = false;
// {Boolean} Compresses JSON values (removes empty strings and null values from JSON)

DEF.jsondate = true;
// {Boolean} Converts date values in JSON automatically to Date object

DEF.keypress = true;
// {Boolean} Can disable real-time keypress binding

DEF.localstorage = true;
// {Boolean} Can disable localstorage

DEF.pingdata = {};
// {Object} Can contain GET params for PING method

DEF.thousandsseparator = ' ';
// {String} Default thousands separator

DEF.version = '1';
// {String} A default version for all jComponents
// Default: empty
// +v14.0.0

Property: MAIN.validators

Contains RegExp validators.

MAIN.validators;
// returns {Object}

MAIN.validators.url;
// RegExp for URL addresses

MAIN.validators.email;
// RegExp for email addresses

MAIN.validators.phone;
// RegExp for phone numbers

Property: MAIN.loaded

readonly Determines whether is jComponent loaded (cache + document is ready).

MAIN.loaded;
// returns {Boolean}

Property: MAIN.version

readonly Returns the current build version of jComponent.

MAIN.version;
// returns {Number}

// For example:
// 16.027

Property: MAIN.$components

readonly Gets all registered components, only types - not instances.

MAIN.$components;
// returns {Object}

Property: MAIN.$language

Affects all AJAX() requests, it appends GET argument ?language=$language automatically to the URL address.

MAIN.$language = '';
// returns {String}

Property: MAIN.$localstorage

Returns a localStorage key for jComponent. You can change this key by your needs.

MAIN.$localstorage = 'jc';
// returns {String}

Property: MAIN.$version

Affects all AJAX() requests, it appends GET argument ?version=$version automatically to the URL address.

MAIN.$version = '';
// returns {String}