Suggestion with JS system architecture

0

Hello, is everything good?

Currently I have a system made in AS2 that has the functionality of running videos and images. It works with a concept similar to the Finite State Machine.

How is the code made? It runs within an enterframe, executing several things at each loop "pass", validating if the video is running out, etc.

With the "death" of Flash and other issues, we need to migrate (basically create from 0) this system for JS, but I can not think of an architecture that can do that.

Using something like setInterval in every part of the code does not seem to me at all to be an elegant solution. How can I have multiple tasks running multiple times?

In general, what my application has to do is to analyze all the time if there is something to do, be it to download, display a video, etc.

Well, I hope my question has been clear. Thanks in advance.

Edit: The project will be a video player. As you play, I have to keep doing other tasks.

How does this work today? I have a C project that controls all hardware, display videos and manage download.

My need is now to have a project in JS that from time to time runs routines, such as see if there is something new to download from the server, send a video and during that, analyze if it's over, etc.

What I do not know how to do is how to create this task cycle, type, how to do it perform my tasks every X period. In FLASH we use the Onenterframe, but this consumes a lot of performance since it will always run the whole code and validate if it is time to do some tasks.

    
asked by anonymous 08.10.2015 / 15:12

0 answers