taniarascia / comments

Comments
7 stars 0 forks source link

javascript-mvc-todo-app/ #44

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Build a Simple MVC App From Scratch in JavaScript | Tania Rascia

I wanted to write a simple application in plain JavaScript using the model-view-controller architectural pattern. So I did, and here it is…

https://www.taniarascia.com/javascript-mvc-todo-app/

troflog commented 3 years ago

Hello. What type of event design pattern have us used here?

Dwigth commented 3 years ago

Just what i needed, thanks!

picakciali commented 3 years ago

thanks

dgvirtual commented 3 years ago

I am confused about how the changes in the data/model trigger the redraw of the view through the controller - all those "binding" functions blow my fuses... Could you recommend a good resource to read more about the function binding that you use here?

dnnsjrng commented 3 years ago

Thanks for this tutorial. I learned a lot from it. Especially the communication between the 3 classes.

I have one question reg. callbacks/handlers. Why do you call this bindAddTodo(handler) Argument a handler and on the other side bindTodoListchanged(callback) argument a callback? A callback is a function that is passed as an argument to another function and executed later. Isn't the handler a function handleAddTodo from the controller class?

Thanks for your help!

erfanatp commented 3 years ago

Thank you for this article. I'm trying to create an app with this approach. But I have a problem with multiple views and apps. How to remove an app instance and replace it with the other one, by clicking on menu item for example.

dnnsjrng commented 3 years ago

@erfanatp I implemented different views by dynamically add / remove containers in the DOM, to show the requested content for example "Overview", "ListView", "Editor" etc. pp. You just have to add EventListener and then remove the existing and add the requested content.

ajn404 commented 3 years ago

tql

thora-asterix commented 3 years ago

This is such a great tutorial for the MVC model, thank you Tania.

Dylan-Cairns commented 3 years ago

This was a fantastic tutorial, thank you!

DorrKim commented 2 years ago

Thank you for your posting. If possible, I would like to translate this article and share it with Korean developers, can I translate it?

ekomobong-dev commented 2 years ago

Thanks

SerovaN commented 2 years ago

Can you please tell me if this problem can be solved?

I would like the words entered in the list to be replaced with links using the replace() method. I've tried changing them with JavaScript + window.onload and jQuery + $(function() and $(document).ready(function() .

Links are being added, but I am not able to add a new entry, as if blocked.

Can you please tell me if there is a way to fix this?

soli-rsa commented 2 years ago

Greetings From South Africa

Thank you for creating such amazing content. I bumped into this today and I've just been stuck here reading (instead of working 🤦🏾‍♂️😅)

neebs12 commented 2 years ago

Hi Tania! Thank you for this resource. It has been really helpful! I think in this section: live edit functionality we can do away with _initLocalListeners by scrutinizing the textual content of the target element within the focusout handler.

This refactor of bindEditTodo retains identical functionality while removing _initLocalListeners and this._temporaryTodoText.

bindEditTodo(handler) {
  this.todoList.addEventListener('focusout', event => {
    let txt = event.target.textContent;
    if (txt) {
      let parent = event.target.parentElement;
      handler(+parent.id, txt);
    }
  });
}
1ucasdev commented 9 months ago

Thanks for the detailed information! I'll try to use it for an calculator online with tape. Best wishes!

tawfikkhaled commented 4 months ago

Thank you! A very good starting point to the mvc world.