lundi 26 juillet 2021

Is there a JS design pattern to combine N objects into 1 façade object and have code editors know which methods it has?

for example suppose I have:

var obj_a = {
  foo: function() {}
}

var obj_b = {
  bar: function() {}
}

How should I declare obj_c to have both methods so that typing obj_c. would popup foo and bar as valid autocomplete options?

Aucun commentaire:

Enregistrer un commentaire