Commit 915b5888 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

autosave timer

coedit - 10min
edit - 2sec

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56711 954022d7-b5bf-4e40-9824-e11837661b57
parent d4ef78cf
......@@ -151,6 +151,11 @@ function CEditorPage(api)
this.m_oScrollHorApi = null;
this.m_oScrollVerApi = null;
this.m_nIntervalSlowAutosave = 600000;
this.m_nIntervalFastAutosave = 2000;
this.m_nIntervalWaitAutoSave = 1000;
this.m_nLastAutosaveTime = -1;
this.arrayEventHandlers = [];
this.m_oTimerScrollSelect = -1;
......@@ -3531,6 +3536,36 @@ function CEditorPage(api)
oWordControl.m_oDrawingDocument.CheckTrackTable();
}
if (oWordControl.m_oApi.isAutoSave)
{
var _curTime = new Date().getTime();
if (-1 == oWordControl.m_nLastAutosaveTime)
{
oWordControl.m_nLastAutosaveTime = _curTime;
}
var _bIsWaitScheme = false;
if (History.Points && History.Index >= 0 && History.Index < History.Points.length)
{
if ((_curTime - History.Points[History.Index].Time) < oWordControl.m_nIntervalWaitAutoSave)
_bIsWaitScheme = true;
}
if (!_bIsWaitScheme)
{
var _interval = (CollaborativeEditing.m_nUseType <= 0) ? oWordControl.m_nIntervalSlowAutosave : oWordControl.m_nIntervalFastAutosave;
if ((_curTime - oWordControl.m_nLastAutosaveTime) > _interval)
{
if (History.Have_Changes() == true)
{
oWordControl.m_oApi.asc_Save2();
}
oWordControl.m_nLastAutosaveTime = _curTime;
}
}
}
this.m_nPaintTimerId = setTimeout(oWordControl.onTimerScroll2, oWordControl.m_nTimerScrollInterval);
//window.requestAnimationFrame(oWordControl.onTimerScroll2);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment