|
@@ -6,7 +6,10 @@ import { react2angular } from 'react2angular'
|
|
|
import { rootContext } from '../../../shared/context/root-context'
|
|
import { rootContext } from '../../../shared/context/root-context'
|
|
|
import 'ace/ace'
|
|
import 'ace/ace'
|
|
|
import getMeta from '../../../utils/meta'
|
|
import getMeta from '../../../utils/meta'
|
|
|
-import { waitForServiceWorker } from '../../pdfng/directives/serviceWorkerManager'
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ waitForServiceWorker,
|
|
|
|
|
+ unregisterServiceWorker,
|
|
|
|
|
+} from '../../pdfng/directives/serviceWorkerManager'
|
|
|
import { trackPdfDownload } from './PdfJsMetrics'
|
|
import { trackPdfDownload } from './PdfJsMetrics'
|
|
|
|
|
|
|
|
const AUTO_COMPILE_MAX_WAIT = 5000
|
|
const AUTO_COMPILE_MAX_WAIT = 5000
|
|
@@ -272,18 +275,22 @@ App.controller(
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ const serviceWorker = getMeta('ol-enablePdfCaching')
|
|
|
|
|
+ ? waitForServiceWorker()
|
|
|
|
|
+ : Promise.resolve()
|
|
|
|
|
+
|
|
|
|
|
+ ide.$scope.$on('service-worker:unregister', unregisterServiceWorker)
|
|
|
|
|
+
|
|
|
function sendCompileRequest(options) {
|
|
function sendCompileRequest(options) {
|
|
|
if (options == null) {
|
|
if (options == null) {
|
|
|
options = {}
|
|
options = {}
|
|
|
}
|
|
}
|
|
|
const url = `/project/${$scope.project_id}/compile`
|
|
const url = `/project/${$scope.project_id}/compile`
|
|
|
- let setup = Promise.resolve()
|
|
|
|
|
const params = {}
|
|
const params = {}
|
|
|
if (options.isAutoCompileOnLoad || options.isAutoCompileOnChange) {
|
|
if (options.isAutoCompileOnLoad || options.isAutoCompileOnChange) {
|
|
|
params.auto_compile = true
|
|
params.auto_compile = true
|
|
|
}
|
|
}
|
|
|
if (getMeta('ol-enablePdfCaching')) {
|
|
if (getMeta('ol-enablePdfCaching')) {
|
|
|
- setup = waitForServiceWorker()
|
|
|
|
|
params.enable_pdf_caching = true
|
|
params.enable_pdf_caching = true
|
|
|
}
|
|
}
|
|
|
// if the previous run was a check, clear the error logs
|
|
// if the previous run was a check, clear the error logs
|
|
@@ -314,7 +321,7 @@ App.controller(
|
|
|
checkType = 'silent'
|
|
checkType = 'silent'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return setup.then(() =>
|
|
|
|
|
|
|
+ return serviceWorker.then(() =>
|
|
|
$http.post(
|
|
$http.post(
|
|
|
url,
|
|
url,
|
|
|
{
|
|
{
|