mcnLeandro / UML_App

0 stars 0 forks source link

Interface dependency injection #26

Closed mcnLeandro closed 3 years ago

mcnLeandro commented 3 years ago

If use Interface(not actual) have to think about dependency injection

JavaScript is dynamic, and we can't type declaration.

interface Focusable {
    focus(){}
}

Class Focus {
  // js is dynamic so argument name is important to express dependency injection
    focuTo(focusable){
        focusable.focus()
    }
}
mcnLeandro commented 3 years ago

Resolved, There was no unsuitable argument name, so did't changed any of arguments

750c253

Close this issue