fix cache

This commit is contained in:
yuri
2016-02-08 18:22:56 +02:00
parent cce8186ccf
commit 05ac6ea0b8
5 changed files with 17 additions and 4 deletions

View File

@@ -32,13 +32,15 @@ var Espo = Espo || {classMap:{}};
var root = this;
Espo.Loader = function (cache) {
Espo.Loader = function (cache, cacheTimestamp) {
this.cache = cache || null;
this._loadCallbacks = {};
this.pathsBeingLoaded = {};
this.libsConfig = {};
this.cacheTimestamp = cacheTimestamp || null;
}
_.extend(Espo.Loader.prototype, {
@@ -282,9 +284,16 @@ var Espo = Espo || {classMap:{}};
}
this.pathsBeingLoaded[path] = true;
var useCache = false;
if (this.cacheTimestamp) {
useCache = true;
var sep = (path.indexOf('?') > -1) ? '&' : '?';
path += sep + 'r=' + this.cacheTimestamp;
}
$.ajax({
type: 'GET',
cache: false,
cache: useCache,
dataType: 'text',
local: true,
url: path,

View File

@@ -37,7 +37,8 @@
Espo.require('app', function (App) {
var app = new App({
useCache: false,
url: '../api/v1',
cacheTimestamp: {{cacheTimestamp}},
url: '../api/v1'
}, function (app) {
{{runScript}}
});

View File

@@ -38,7 +38,8 @@
var app = new App({
id: '{{portalId}}',
useCache: false,
url: '../api/v1/portal/{{portalId}}',
cacheTimestamp: {{cacheTimestamp}},
url: '../api/v1/portal/{{portalId}}'
}, function (app) {
{{runScript}}
});

View File

@@ -13,6 +13,7 @@
<link rel="shortcut icon" href="client/img/favicon.ico" type="image/x-icon">
<script type="text/javascript">
$(function () {
Espo.loader.cacheTimestamp = {{cacheTimestamp}};
Espo.require('app', function (App) {
var app = new App({
useCache: {{useCache}},

View File

@@ -13,6 +13,7 @@
<link rel="shortcut icon" href="client/img/favicon.ico" type="image/x-icon">
<script type="text/javascript">
$(function () {
Espo.loader.cacheTimestamp = {{cacheTimestamp}};
Espo.require('app-portal', function (App) {
var app = new App({
id: '{{portalId}}',