diff --git a/src/app/examples/custom-inputEditor.ts b/src/app/examples/custom-inputEditor.ts index 7ef51246..f8f24095 100644 --- a/src/app/examples/custom-inputEditor.ts +++ b/src/app/examples/custom-inputEditor.ts @@ -58,7 +58,7 @@ export class CustomInputEditor implements Editor { this.inputElm.addEventListener('focusout', this.save.bind(this)); } - setTimeout(() => { + window.setTimeout(() => { this.inputElm.focus(); this.inputElm.select(); }, 50); diff --git a/src/app/examples/grid-base-row-editing.component.ts b/src/app/examples/grid-base-row-editing.component.ts index 4106d7b7..9f4ebc56 100644 --- a/src/app/examples/grid-base-row-editing.component.ts +++ b/src/app/examples/grid-base-row-editing.component.ts @@ -257,7 +257,7 @@ export class GridBaseRowEditingComponent implements OnInit { function fakeFetch(_input: string | URL | Request, _init?: RequestInit | undefined): Promise { return new Promise((resolve) => { - setTimeout(() => { + window.setTimeout(() => { resolve(new Response(JSON.stringify({ status: 200, message: 'success' }))); // reduces the delay for automated Cypress tests }, (window as any).Cypress ? 10 : 500); diff --git a/src/app/examples/grid-clientside.component.ts b/src/app/examples/grid-clientside.component.ts index a0ca3242..06b8f839 100644 --- a/src/app/examples/grid-clientside.component.ts +++ b/src/app/examples/grid-clientside.component.ts @@ -271,7 +271,7 @@ export class GridClientSideComponent implements OnInit { refreshMetrics(e: Event, args: any) { if (args && args.current >= 0) { - setTimeout(() => { + window.setTimeout(() => { this.metrics = { startTime: new Date(), endTime: new Date(), diff --git a/src/app/examples/grid-composite-editor.component.ts b/src/app/examples/grid-composite-editor.component.ts index b293235b..15cdc410 100644 --- a/src/app/examples/grid-composite-editor.component.ts +++ b/src/app/examples/grid-composite-editor.component.ts @@ -650,7 +650,7 @@ export class GridCompositeEditorComponent implements OnDestroy, OnInit { // when processing a mass update or mass selection if (modalType === 'mass-update' || modalType === 'mass-selection') { return new Promise((resolve, reject) => { - setTimeout(() => { + window.setTimeout(() => { if (formValues.percentComplete >= 50) { resolve(true); } else { @@ -663,7 +663,7 @@ export class GridCompositeEditorComponent implements OnDestroy, OnInit { // we'll just apply the change without any rejection from the server and // note that we also have access to the "dataContext" which is only available for these modal console.log(`${modalType} item data context`, dataContext); - return new Promise(resolve => setTimeout(() => resolve(true), serverResponseDelay)); + return new Promise(resolve => window.setTimeout(() => resolve(true), serverResponseDelay)); } } }); diff --git a/src/app/examples/grid-custom-tooltip.component.ts b/src/app/examples/grid-custom-tooltip.component.ts index 9e4e65df..17be65fd 100644 --- a/src/app/examples/grid-custom-tooltip.component.ts +++ b/src/app/examples/grid-custom-tooltip.component.ts @@ -76,7 +76,7 @@ export class GridCustomTooltipComponent implements OnInit { // you will need to provide an `asyncPost` function returning a Promise and also `asyncPostFormatter` formatter to display the result once the Promise resolves formatter: () => `
loading...
`, asyncProcess: () => new Promise(resolve => { - setTimeout(() => resolve({ ratio: Math.random() * 10 / 10, lifespan: Math.random() * 100 }), this.serverApiDelay); + window.setTimeout(() => resolve({ ratio: Math.random() * 10 / 10, lifespan: Math.random() * 100 }), this.serverApiDelay); }), asyncPostFormatter: this.tooltipTaskAsyncFormatter as Formatter, @@ -180,7 +180,7 @@ export class GridCustomTooltipComponent implements OnInit { // 2- delay the opening by a simple Promise and `setTimeout` asyncProcess: () => new Promise(resolve => { - setTimeout(() => resolve({}), this.serverApiDelay); // delayed by half a second + window.setTimeout(() => resolve({}), this.serverApiDelay); // delayed by half a second }), asyncPostFormatter: this.tooltipFormatter.bind(this) as Formatter, }, @@ -235,7 +235,7 @@ export class GridCustomTooltipComponent implements OnInit { // OR 2- use a Promise collectionAsync: new Promise((resolve) => { - setTimeout(() => { + window.setTimeout(() => { resolve(Array.from(Array(this.dataset.length).keys()).map(k => ({ value: k, label: k, prefix: 'Task', suffix: 'days' }))); }, 500); }), @@ -252,7 +252,7 @@ export class GridCustomTooltipComponent implements OnInit { filter: { // collectionAsync: fetch(URL_SAMPLE_COLLECTION_DATA), collectionAsync: new Promise((resolve) => { - setTimeout(() => { + window.setTimeout(() => { resolve(Array.from(Array(this.dataset.length).keys()).map(k => ({ value: k, label: `Task ${k}` }))); }); }), diff --git a/src/app/examples/grid-editor.component.ts b/src/app/examples/grid-editor.component.ts index 190e1c4b..1d0c1739 100644 --- a/src/app/examples/grid-editor.component.ts +++ b/src/app/examples/grid-editor.component.ts @@ -500,7 +500,7 @@ export class GridEditorComponent implements OnInit { const newRows = this.mockData(1, lastRowIndex); // wrap into a timer to simulate a backend async call - setTimeout(() => { + window.setTimeout(() => { const requisiteColumnDef = this.columnDefinitions.find((column: Column) => column.id === 'prerequisites'); if (requisiteColumnDef) { const filterCollectionAsync = requisiteColumnDef.filter!.collectionAsync; diff --git a/src/app/examples/grid-formatter.component.ts b/src/app/examples/grid-formatter.component.ts index 0b9f1b26..48c001bf 100644 --- a/src/app/examples/grid-formatter.component.ts +++ b/src/app/examples/grid-formatter.component.ts @@ -155,7 +155,7 @@ export class GridFormatterComponent implements OnInit { item.completed = !item.completed; // simulate a backend http call and refresh the grid row after delay - setTimeout(() => { + window.setTimeout(() => { this.angularGrid.gridService.updateItemById(item.id, item, { highlightRow: false }); }, 250); } diff --git a/src/app/examples/grid-graphql.component.ts b/src/app/examples/grid-graphql.component.ts index 8404c6ea..196d5f52 100644 --- a/src/app/examples/grid-graphql.component.ts +++ b/src/app/examples/grid-graphql.component.ts @@ -307,7 +307,7 @@ export class GridGraphqlComponent implements OnInit, OnDestroy { }; return new Promise(resolve => { - setTimeout(() => { + window.setTimeout(() => { this.graphqlQuery = this.angularGrid.backendService!.buildQuery(); if (this.isWithCursor) { // When using cursor pagination, the pagination service needs to be updated with the PageInfo data from the latest request @@ -388,7 +388,7 @@ export class GridGraphqlComponent implements OnInit, OnDestroy { { columnId: 'name', direction: 'asc' }, { columnId: 'company', direction: SortDirection.DESC } ]); - setTimeout(() => { + window.setTimeout(() => { this.angularGrid.paginationService?.changeItemPerPage(20); this.angularGrid.paginationService?.goToPageNumber(2); }); diff --git a/src/app/examples/grid-infinite-graphql.component.ts b/src/app/examples/grid-infinite-graphql.component.ts index d8dd091e..97c32139 100644 --- a/src/app/examples/grid-infinite-graphql.component.ts +++ b/src/app/examples/grid-infinite-graphql.component.ts @@ -311,7 +311,7 @@ export class GridInfiniteGraphqlComponent implements OnInit, OnDestroy { }, }; - setTimeout(() => { + window.setTimeout(() => { this.graphqlQuery = this.gridOptions.backendServiceApi!.service.buildQuery(); resolve(mockedResult); }, this.serverWaitDelay); diff --git a/src/app/examples/grid-infinite-odata.component.ts b/src/app/examples/grid-infinite-odata.component.ts index d86f8b29..d8db12b6 100644 --- a/src/app/examples/grid-infinite-odata.component.ts +++ b/src/app/examples/grid-infinite-odata.component.ts @@ -343,7 +343,7 @@ export class GridInfiniteOdataComponent implements OnInit { } const updatedData = filteredData.slice(firstRow, firstRow + top); - setTimeout(() => { + window.setTimeout(() => { const backendResult: any = { query }; backendResult['value'] = updatedData; backendResult['@odata.count'] = countTotalItems; diff --git a/src/app/examples/grid-odata.component.ts b/src/app/examples/grid-odata.component.ts index 3de81c4e..4df93724 100644 --- a/src/app/examples/grid-odata.component.ts +++ b/src/app/examples/grid-odata.component.ts @@ -393,7 +393,7 @@ export class GridOdataComponent implements OnInit { } const updatedData = filteredData.slice(firstRow, firstRow + top!); - setTimeout(() => { + window.setTimeout(() => { const backendResult: any = { query }; if (!this.isCountEnabled) { backendResult['totalRecordCount'] = countTotalItems; diff --git a/src/app/examples/grid-range.component.ts b/src/app/examples/grid-range.component.ts index a1bbe10e..c2858c2d 100644 --- a/src/app/examples/grid-range.component.ts +++ b/src/app/examples/grid-range.component.ts @@ -238,8 +238,8 @@ export class GridRangeComponent implements OnInit, OnDestroy { } refreshMetrics(_e: Event, args: any) { - if (args && args.current >= 0) { - setTimeout(() => { + if (args?.current >= 0) { + window.setTimeout(() => { this.metrics = { startTime: new Date(), itemCount: args && args.current || 0, diff --git a/src/app/examples/grid-rowdetail.component.ts b/src/app/examples/grid-rowdetail.component.ts index 2484ec17..6e0e6d69 100644 --- a/src/app/examples/grid-rowdetail.component.ts +++ b/src/app/examples/grid-rowdetail.component.ts @@ -220,7 +220,7 @@ export class GridRowDetailComponent implements OnDestroy, OnInit { // fill the template on async delay return new Promise((resolve) => { - setTimeout(() => { + window.setTimeout(() => { const itemDetail = item; // let's add some extra properties to our item for a better async simulation diff --git a/src/app/examples/grid-state.component.ts b/src/app/examples/grid-state.component.ts index 1722e829..58a32a64 100644 --- a/src/app/examples/grid-state.component.ts +++ b/src/app/examples/grid-state.component.ts @@ -75,7 +75,7 @@ export class GridStateComponent implements OnInit, OnDestroy { clearGridStateFromLocalStorage() { this.angularGrid.gridService.resetGrid(this.columnDefinitions); this.angularGrid.paginationService!.changeItemPerPage(DEFAULT_PAGE_SIZE); - setTimeout(() => localStorage[LOCAL_STORAGE_KEY] = null); + window.setTimeout(() => localStorage[LOCAL_STORAGE_KEY] = null); } /* Define grid Options and Columns */ diff --git a/src/app/examples/grid-trading.component.ts b/src/app/examples/grid-trading.component.ts index 9af6ed25..6250f79f 100644 --- a/src/app/examples/grid-trading.component.ts +++ b/src/app/examples/grid-trading.component.ts @@ -101,7 +101,7 @@ export class GridTradingComponent implements OnDestroy, OnInit { minChangePerCycle = 0; maxChangePerCycle = 10; refreshRate = 75; - timer: any; + timer?: number; ngOnInit(): void { this.defineGrid(); @@ -109,7 +109,7 @@ export class GridTradingComponent implements OnDestroy, OnInit { // mock a dataset this.dataset = this.loadData(NB_ROWS); - setTimeout(() => { + window.setTimeout(() => { this.startSimulation(); }, this.refreshRate); } @@ -310,11 +310,11 @@ export class GridTradingComponent implements OnDestroy, OnInit { // but the cell highlight actually does that for us so we can skip it } - this.timer = setTimeout(this.startSimulation.bind(this), this.refreshRate || 0); + this.timer = window.setTimeout(this.startSimulation.bind(this), this.refreshRate || 0); } stopSimulation() { - clearTimeout(this.timer); + window.clearTimeout(this.timer); } findColumnById(columnName: string): Column { @@ -329,7 +329,7 @@ export class GridTradingComponent implements OnDestroy, OnInit { this.angularGrid.slickGrid.setCellCssStyles(`highlight_${[column.id]}${row}`, hash); // remove highlight after x amount of time - setTimeout(() => this.removeCellStyling(item, column, row), this.highlightDuration); + window.setTimeout(() => this.removeCellStyling(item, column, row), this.highlightDuration); } } } diff --git a/src/app/examples/grid-tree-data-hierarchical.component.ts b/src/app/examples/grid-tree-data-hierarchical.component.ts index 6622ec96..3a4c3579 100644 --- a/src/app/examples/grid-tree-data-hierarchical.component.ts +++ b/src/app/examples/grid-tree-data-hierarchical.component.ts @@ -310,7 +310,7 @@ export class GridTreeDataHierarchicalComponent implements OnInit { this.datasetHierarchical = tmpDatasetHierarchical; // scroll into the position, after insertion cycle, where the item was added - setTimeout(() => { + window.setTimeout(() => { const rowIndex = this.dataViewObj.getRowById(popFolderItem.id); this.gridObj.scrollRowIntoView(rowIndex + 3); }, 10); diff --git a/src/app/examples/grid-tree-data-parent-child.component.ts b/src/app/examples/grid-tree-data-parent-child.component.ts index 6a3dea5f..e50738af 100644 --- a/src/app/examples/grid-tree-data-parent-child.component.ts +++ b/src/app/examples/grid-tree-data-parent-child.component.ts @@ -217,7 +217,7 @@ export class GridTreeDataParentChildComponent implements OnInit { } hideSpinner() { - setTimeout(() => this.loadingClass = '', 200); // delay the hide spinner a bit to avoid show/hide too quickly + window.setTimeout(() => this.loadingClass = '', 200); // delay the hide spinner a bit to avoid show/hide too quickly } showSpinner() { diff --git a/src/app/examples/swt-common-grid-test.component.ts b/src/app/examples/swt-common-grid-test.component.ts index 30d419d8..5b5edd8d 100644 --- a/src/app/examples/swt-common-grid-test.component.ts +++ b/src/app/examples/swt-common-grid-test.component.ts @@ -41,7 +41,7 @@ export class SwtCommonGridTestComponent implements OnInit, AfterViewInit { ngAfterViewInit() { this.logger.info('method [ngAfterViewInit] - START'); - setTimeout(() => { + window.setTimeout(() => { // Init datagrid example: this.commonGridPag.processing = true; @@ -92,7 +92,7 @@ export class SwtCommonGridTestComponent implements OnInit, AfterViewInit { this.commonGridPag.processing = false; } );*/ - setTimeout(() => { + window.setTimeout(() => { this.commonGrid.gridData = data_sample.pagination_samples.grid.rows; this.commonGridPag.pageCount = data_sample.pagination_samples.grid.rows.maxpage; }, 750); diff --git a/src/app/examples/swt-common-grid.component.ts b/src/app/examples/swt-common-grid.component.ts index a98421bf..bd2f0158 100644 --- a/src/app/examples/swt-common-grid.component.ts +++ b/src/app/examples/swt-common-grid.component.ts @@ -19,7 +19,7 @@ import { SwtCommonGridPaginationComponent } from './swt-common-grid-pagination.c * @author Saber Chebka, saber.chebka@gmail.com */ -let timer: any; +let timer: number | undefined; const DEFAULT_FILTER_TYPING_DEBOUNCE = 750; @Component({ @@ -338,9 +338,9 @@ export class SwtCommonGridComponent implements OnInit, AfterViewInit, BackendSer let timing = 0; if (event && (event.type === 'keyup' || event.type === 'keydown')) { timing = DEFAULT_FILTER_TYPING_DEBOUNCE; - clearTimeout(timer); + window.clearTimeout(timer); } - timer = setTimeout(() => { + timer = window.setTimeout(() => { this.filteredGridColumns = ''; for (const column of this.columnDefinitions) { if (column.field in args.columnFilters) { diff --git a/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts b/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts index e1f9b434..7bb06266 100644 --- a/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts +++ b/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts @@ -205,8 +205,8 @@ export class SlickRowDetailView extends UniversalSlickRowDetailView { // on filter changed, we need to re-render all Views this._subscriptions.push( this.eventPubSubService?.subscribe('onFilterChanged', this.redrawAllViewComponents.bind(this)), - this.eventPubSubService?.subscribe('onGridMenuClearAllFilters', () => setTimeout(() => this.redrawAllViewComponents())), - this.eventPubSubService?.subscribe('onGridMenuClearAllSorting', () => setTimeout(() => this.redrawAllViewComponents())), + this.eventPubSubService?.subscribe('onGridMenuClearAllFilters', () => window.setTimeout(() => this.redrawAllViewComponents())), + this.eventPubSubService?.subscribe('onGridMenuClearAllSorting', () => window.setTimeout(() => this.redrawAllViewComponents())), ); } }