This commit is contained in:
Yuri Kuznetsov
2022-06-15 15:37:22 +03:00
parent 7375149ada
commit 2da413754e
4 changed files with 111 additions and 8 deletions
+46 -2
View File
@@ -29,66 +29,110 @@
define('action-handler', [], function () {
/**
* An action handler.
* An action handler. To be extended by specific action handlers.
*
* @class
* @name Class
* @param {module:view.Class} view A view.
* @memberOf module:action-handler
*/
let ActionHandler = function (view) {
/**
* @type {module:view.Class}
* @protected
*/
this.view = view;
};
_.extend(ActionHandler.prototype, {
_.extend(ActionHandler.prototype, /** @lends {module:action-handler.Class#} */ {
/**
* @deprecated Use `this.view`.
*/
getConfig: function () {
return this.view.getConfig();
},
/**
* @deprecated Use `this.view`.
*/
getMetadata: function () {
return this.view.getMetadata();
},
/**
* @deprecated Use `this.view`.
*/
getAcl: function () {
return this.view.getAcl();
},
/**
* @deprecated Use `this.view`.
*/
getUser: function () {
return this.view.getUser();
},
/**
* @deprecated Use `this.view`.
*/
getRouter: function () {
return this.view.getRouter();
},
/**
* @deprecated Use `this.view`.
*/
getHelper: function () {
return this.view.getHelper();
},
/**
* @deprecated Use `this.view`.
*/
getLanguage: function () {
return this.view.getLanguage();
},
/**
* @deprecated Use `this.view`.
*/
getModelFactory: function () {
return this.view.getModelFactory();
},
/**
* @deprecated Use `this.view`.
*/
getCollectionFactory: function () {
return this.view.getCollectionFactory();
},
/**
* @deprecated Use `Espo.Ajax`.
*/
ajaxPostRequest: function () {
return this.view.ajaxPostRequest.apply(this.view, arguments);
},
/**
* @deprecated Use `Espo.Ajax`.
*/
ajaxPutRequest: function () {
return this.view.ajaxPutRequest.apply(this.view, arguments);
},
/**
* @deprecated Use `Espo.Ajax`.
*/
ajaxGetRequest: function () {
return this.view.ajaxGetRequest.apply(this.view, arguments);
},
/**
* @deprecated Use `this.view`.
*/
confirm: function () {
return this.view.confirm.apply(this.view, arguments);
},
+3
View File
@@ -237,7 +237,10 @@ function (
collectionFactory: null,
/**
* A view factory.
*
* @private
* @type {Bull.Factory}
*/
viewFactory: null,
+61 -5
View File
@@ -28,6 +28,14 @@
define('cache', [], function () {
/**
* Cache for source and resource files.
*
* @class
* @name Class
* @memberOf module:cache
* @param {Number} [cacheTimestamp] A cache timestamp.
*/
var Cache = function (cacheTimestamp) {
this.basePrefix = this.prefix;
@@ -40,19 +48,25 @@ define('cache', [], function () {
}
};
_.extend(Cache.prototype, {
_.extend(Cache.prototype, /** @lends module:cache.Class# */ {
/**
* @private
*/
prefix: 'cache',
/**
* Handle actuality. Clears cache if not actual.
*
* @param {Number} cacheTimestamp A cache timestamp.
*/
handleActuality: function (cacheTimestamp) {
let storedTimestamp = this.getCacheTimestamp();
if (storedTimestamp) {
if (storedTimestamp !== cacheTimestamp) {
this.clear();
this.set('app', 'cacheTimestamp', cacheTimestamp);
this.storeTimestamp();
}
@@ -60,36 +74,65 @@ define('cache', [], function () {
}
this.clear();
this.set('app', 'cacheTimestamp', cacheTimestamp);
this.storeTimestamp();
},
/**
* Get a cache timestamp.
*
* @returns {number}
*/
getCacheTimestamp: function () {
return parseInt(this.get('app', 'cacheTimestamp') || 0);
},
/**
* @deprecated
* @todo Revise whether is needed.
*/
storeTimestamp: function () {
let frontendCacheTimestamp = Date.now();
this.set('app', 'timestamp', frontendCacheTimestamp);
},
/**
* @private
* @param {string} type
* @returns {string}
*/
composeFullPrefix: function (type) {
return this.prefix + '-' + type;
},
/**
* @private
* @param {string} type
* @param {string} name
* @returns {string}
*/
composeKey: function (type, name) {
return this.composeFullPrefix(type) + '-' + name;
},
/**
* @private
* @param {string} type
*/
checkType: function (type) {
if (typeof type === 'undefined' && toString.call(type) !== '[object String]') {
throw new TypeError("Bad type \"" + type + "\" passed to Cache().");
}
},
/**
* Get a stored value.
*
* @param {string} type A type/category.
* @param {string} name A name.
* @returns {string|null} Null if no stored value.
*/
get: function (type, name) {
this.checkType(type);
@@ -126,6 +169,13 @@ define('cache', [], function () {
return null;
},
/**
* Store a value.
*
* @param {string} type A type/category.
* @param {string} name A name.
* @param {any} value A value.
*/
set: function (type, name, value) {
this.checkType(type);
@@ -143,6 +193,12 @@ define('cache', [], function () {
}
},
/**
* Clear a stored value.
*
* @param {string} type A type/category.
* @param {string} name A name.
*/
clear: function (type, name) {
let reText;
+1 -1
View File
@@ -99,7 +99,7 @@ define('controller', [], function () {
/**
* A view factory.
*
* @type {Bull.ViewFactory}
* @type {Bull.Factory}
* @protected
*/
viewFactory: null,