0

hope you're all doing well :)

This is not really a coding question, but more of a 'where do you put the code' question...

I am using Famo.us and building an application that comprises of a number of child Views. A quick description of the approach would be:

-mainFile
  Creates the Famo.us Context
  Creates new Widget() object and adds it to the Context
  Backend stuff

-Widget file (Application Object)
  Creates Layout
  Creates Views
  Creates Menu
  Creates 'Click' Listeners for Views surfaces and containers within

-Views (various) - various Views (ScrollViews, ContainerSurfaces, Famous-Flex)
  Creates inner Views and Surfaces

I want to start adding Mouse and Touch controls...My question is: Where in the hierarchy do you add the code to handle the Touch Events and Mouse Events?

There will be internal ScrollViews, ContainerSurfaces, FlexScrollViews, Views, Surfaces and ImageSurfaces. Some will be scrolled, 'flicked through' or draggable. 'Clicks' are sorted :)

Do I add all the code for Touch Events with each individual View, or at the level I create the Context, or 'Application Object' level? Or is there somewhere else?

All the examples show the code in the same code file as the Surface in the example - yet there are no 'complicated' examples, so wondering Best Practice for the placement of the code to handle Touch and Mouse Events.

Really appreciate your help - hope you are all looking forward to the weekend :)

Thanks again :)

Pandafinity
  • 713
  • 2
  • 7
  • 19
  • There is no definite answer to this question, because it would depend on the use case of every View, Surface and renderable in the application. Best Practice will be subjective also, since there can be many best practice architectures in a Famo.us application. The answers would be based on opinions only and should be left to the developer to make the determination based on education and experience. Maybe you should give one specific use case example application and ask the question with regards to that case. – talves Jan 23 '15 at 18:39
  • Thanks for replying :). So basically I can put whatever code at whatever level in terms of the 'Famo.us' Standards. I was hoping there was some insight regarding Re-use. But I will try and add all 'draggable' code in the specific views and Touchy Mousey events at the application level, and see what happens. Thanks for replying. – Pandafinity Jan 24 '15 at 11:09

0 Answers0