mirror of
https://github.com/Redocly/redoc.git
synced 2025-07-04 11:03:03 +03:00
fix: do not load SearchWorker if disableSearch is true
(#1191)
Blob URLs may be disabled by CORS (ex: #764) but should not block execution when the disableSearch option is true
This commit is contained in:
parent
c05db38576
commit
af415e89e8
|
@ -4,8 +4,8 @@ import { OperationModel } from './models';
|
|||
|
||||
import Worker from './SearchWorker.worker';
|
||||
|
||||
function getWorker() {
|
||||
let worker: new () => Worker;
|
||||
|
||||
if (IS_BROWSER) {
|
||||
try {
|
||||
// tslint:disable-next-line
|
||||
|
@ -16,9 +16,11 @@ if (IS_BROWSER) {
|
|||
} else {
|
||||
worker = require('./SearchWorker.worker').default;
|
||||
}
|
||||
return new worker();
|
||||
}
|
||||
|
||||
export class SearchStore<T> {
|
||||
searchWorker = new worker();
|
||||
searchWorker = getWorker();
|
||||
|
||||
indexItems(groups: Array<IMenuItem | OperationModel>) {
|
||||
const recurse = items => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user