Fix custom TodoList implementation API
This commit is contained in:
parent
537e78ac91
commit
f1b953a263
1 changed files with 4 additions and 4 deletions
|
|
@ -474,15 +474,15 @@ In order to deal with that type of refactoring, one can explicitly decide to sup
|
|||
Given the code above, the replacement class would only need to implement the `.push()` and `.map()` methods. By freezing APIs and swapping implementations, the developer can completely avoid touching other layers in the application while refactoring.
|
||||
|
||||
```javascript
|
||||
todo.Todo = Array;
|
||||
todo.TodoList = Array;
|
||||
```
|
||||
|
||||
becomes:
|
||||
|
||||
```javascript
|
||||
todo.Todo = {
|
||||
push: function() { /*...*/ },
|
||||
map: function() { /*...*/ }
|
||||
todo.TodoList = function () {
|
||||
this.push = function() { /*...*/ },
|
||||
this.map = function() { /*...*/ }
|
||||
};
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue