@@ -14,7 +14,8 @@ export interface HeightData {
14
14
}
15
15
16
16
/** checks for obsolete method names */
17
- export function obsolete ( self , f , oldName : string , newName : string , rev : string ) {
17
+ // eslint-disable-next-line
18
+ export function obsolete ( self , f , oldName : string , newName : string , rev : string ) : ( ...args : any [ ] ) => any {
18
19
let wrapper = ( ...args ) => {
19
20
console . warn ( 'gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +
20
21
'with `' + newName + '`. It will be **completely** removed in v1.0' ) ;
@@ -25,7 +26,7 @@ export function obsolete(self, f, oldName: string, newName: string, rev: string)
25
26
}
26
27
27
28
/** checks for obsolete grid options (can be used for any fields, but msg is about options) */
28
- export function obsoleteOpts ( opts : GridStackOptions , oldName : string , newName : string , rev : string ) {
29
+ export function obsoleteOpts ( opts : GridStackOptions , oldName : string , newName : string , rev : string ) : void {
29
30
if ( opts [ oldName ] !== undefined ) {
30
31
opts [ newName ] = opts [ oldName ] ;
31
32
console . warn ( 'gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +
@@ -34,14 +35,14 @@ export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: s
34
35
}
35
36
36
37
/** checks for obsolete grid options which are gone */
37
- export function obsoleteOptsDel ( opts : GridStackOptions , oldName : string , rev : string , info : string ) {
38
+ export function obsoleteOptsDel ( opts : GridStackOptions , oldName : string , rev : string , info : string ) : void {
38
39
if ( opts [ oldName ] !== undefined ) {
39
40
console . warn ( 'gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info ) ;
40
41
}
41
42
}
42
43
43
44
/** checks for obsolete Jquery element attributes */
44
- export function obsoleteAttr ( el : HTMLElement , oldName : string , newName : string , rev : string ) {
45
+ export function obsoleteAttr ( el : HTMLElement , oldName : string , newName : string , rev : string ) : void {
45
46
let oldAttr = el . getAttribute ( oldName ) ;
46
47
if ( oldAttr !== null ) {
47
48
el . setAttribute ( newName , oldAttr ) ;
@@ -106,14 +107,14 @@ export class Utils {
106
107
}
107
108
108
109
/** removed the given stylesheet id */
109
- static removeStylesheet ( id : string ) {
110
+ static removeStylesheet ( id : string ) : void {
110
111
let el = document . querySelector ( 'STYLE[data-gs-style-id=' + id + ']' ) ;
111
112
if ( ! el || ! el . parentNode ) return ;
112
113
el . parentNode . removeChild ( el ) ;
113
114
}
114
115
115
116
/** inserts a CSS rule */
116
- static addCSSRule ( sheet : CSSStyleSheet , selector : string , rules : string ) {
117
+ static addCSSRule ( sheet : CSSStyleSheet , selector : string , rules : string ) : void {
117
118
if ( typeof sheet . addRule === 'function' ) {
118
119
sheet . addRule ( selector , rules ) ;
119
120
} else if ( typeof sheet . insertRule === 'function' ) {
@@ -122,7 +123,7 @@ export class Utils {
122
123
}
123
124
124
125
// eslint-disable-next-line @typescript-eslint/no-explicit-any
125
- static toBool ( v : any ) : boolean {
126
+ static toBool ( v : unknown ) : boolean {
126
127
if ( typeof v === 'boolean' ) {
127
128
return v ;
128
129
}
@@ -154,6 +155,7 @@ export class Utils {
154
155
}
155
156
156
157
/** copies unset fields in target to use the given default sources values */
158
+ // eslint-disable-next-line
157
159
static defaults ( target , ...sources ) : { } {
158
160
159
161
sources . forEach ( source => {
@@ -172,8 +174,9 @@ export class Utils {
172
174
}
173
175
174
176
/** makes a shallow copy of the passed json struct */
177
+ // eslint-disable-next-line
175
178
static clone ( target : { } ) : { } {
176
- return { ...target } ; // was $.extend({}, target)
179
+ return { ...target } ;
177
180
}
178
181
179
182
/** return the closest parent matching the given class */
@@ -185,7 +188,7 @@ export class Utils {
185
188
}
186
189
187
190
/** @internal */
188
- static throttle ( callback : ( ) => void , delay : number ) {
191
+ static throttle ( callback : ( ) => void , delay : number ) : ( ) => void {
189
192
let isWaiting = false ;
190
193
191
194
return ( ...args ) => {
@@ -197,7 +200,7 @@ export class Utils {
197
200
}
198
201
}
199
202
200
- static removePositioningStyles ( el : HTMLElement ) {
203
+ static removePositioningStyles ( el : HTMLElement ) : void {
201
204
let style = el . style ;
202
205
if ( style . position ) {
203
206
style . removeProperty ( 'position' ) ;
@@ -230,7 +233,7 @@ export class Utils {
230
233
}
231
234
232
235
/** @internal */
233
- static updateScrollPosition ( el : HTMLElement , position : { top : number } , distance : number ) {
236
+ static updateScrollPosition ( el : HTMLElement , position : { top : number } , distance : number ) : void {
234
237
// is widget in view?
235
238
let rect = el . getBoundingClientRect ( ) ;
236
239
let innerHeightOrClientHeight = ( window . innerHeight || document . documentElement . clientHeight ) ;
0 commit comments