Expected 'this' to be used by class method 'setFormats'
694 return o
695 }
696
697 setFormats () {698 const f = {}
699
700 f['01'] = { mmm: 'Jan', mmmm: 'January', mm: '01', m: '1', jsmonth: 0 }
Expected 'this' to be used by class method 'subformCollectRecordChildren'
521 return s
522 }
523
524 subformCollectRecordChildren (t, sf, chk, deleteAll, V, E, F, C) {525 const $this = $('#' + t.id)
526 if (t.id.substr(-8) == 'nuDelete') {
527 chk = ($this.prop('checked') || deleteAll) ? 1 : 0
Expected 'this' to be used by class method 'subforms'
511 return d
512 }
513
514 subforms () {515 const s = ['']
516
517 $("[data-nu-subform='true']").each(function (index) {
Expected 'this' to be used by class method 'getJustTables'
444 return tables
445 }
446
447 getJustTables () {448 const tables = []
449
450 for (const key in nuFORM.tableSchema) {
Expected 'this' to be used by class method 'getTables'
432 return forms
433 }
434
435 getTables () {436 const tables = []
437
438 for (const key in nuFORM.tableSchema) {
Expected 'this' to be used by class method 'getForms'
420 return fld
421 }
422
423 getForms () {424 const forms = []
425
426 for (const key in nuFORM.formSchema) {
Expected 'this' to be used by class method 'relationshipFields'
397 return fld
398 }
399
400 relationshipFields () {401 const t = []
402 const fld = []
403
Expected 'this' to be used by class method 'selectFields'
374 return fld
375 }
376
377 selectFields () { // -- from SELECT builder378 const fld = []
379
380 const sqlFrameContents = $('#sqlframe').contents()
Expected 'this' to be used by class method 'unsetSelect'
187 $('.nuTabSelected').click()
188 }
189
190 unsetSelect () {191 $('#nuResponseTabs').remove()
192 $('.nuTab').show()
193 }
Expected 'this' to be used by class method 'setSelect'
67 this.label_length = this.label_length + 5
68 }
69
70 setSelect () { 71 if ($('#nuResponseTabs').length == 1) { return }
72
73 const sel = document.createElement('select')
Expected 'this' to be used by class method 'setStartPosition'
19 $('body').css('transform', 'scale(' + scale + ')')
20 }
21
22 setStartPosition (O) { 23 let id = O.id
24 const lid = 'label_' + O.id
25
Description
If a class method does not use this
, it can sometimes be made into a static function. If you do convert the method into a static function, instances of the class that call that particular method have to be converted to a static call as well (MyClass.callStaticMethod())
Bad Practice
class Person {
sayHi() {
const greeting = document.createElement("div");
greeting.innerText = "Hello!";
document.appendChild();
}
}
const person = new Person();
person.sayHi();
Recommended
class Person {
static sayHi() {
const greeting = document.createElement("div");
greeting.innerText = "Hello!";
document.appendChild();
}
}
Person.sayHi();