Answer the question
In order to leave comments, you need to log in
How to build an asynchronous application?
Answer the question
In order to leave comments, you need to log in
In general, this is a dataflow graph where nodes fire when data has arrived on all incoming arcs (as in (colored) Petri nets). From this point of view, callback is an arc transmitted in a message and to which a response must be sent.
Most implementations stick to the simplified actor model—nodes have only one input, so each message fires. What you need is to have multiple incoming arcs and fire when all of them are filled.
I don’t know ready-made solutions for actionscript, I only know for java - df4j (I wrote it myself, very simple).
en.wikipedia.org/wiki/Flow-based_programming
Actor_Model:
en.wikipedia.org/wiki/%D0%9C%D0%BE%D0%B4%D0%B5%D0%BB%D1%8C_%D0%B0% D0%BA%D1%82%D0%BE%D1%80%D0%BE%D0%B2
en.wikipedia.org/wiki/Callback_ (programming) It's not about patterns, roughly speaking, at the beginning of some action, give it a callback, which should be executed upon completion, and when executing the callback, see if this action is still needed. So the application will work asynchronously, and will not overwrite the data of other actions if the person did not wait for the previous one and clicked something new.
Maybe it makes sense to create an array of the requested data sets and fill them in as they are received, and periodically check from the interface pieces if the data for the current view has appeared?
Something like an array or structure:
struct my_data {
bool received;
uint32 request_time;
uint32 receive_time;
uint8 *buff;
data_struct unpacked_data;
...
};
struct my_data_storage {
struct my_data *main_data;
struct my_data *section1_data;
struct my_data *section2_data;
...
};
In addition to callbacks, it is worth remembering about continuations. Some of its similarity in AS can most likely be implemented.
On SO , the pureMVC framework was sensibly recommended - in the main implementation it is written for AS3, there are ports for JS, C, JAVA, PHP, Ruby and other languages. If you don’t use it right away, then you can at least evaluate the literacy of the implementation by watching introductory presentations about the structure of the framework. The author speaks somewhat monotonously, so stock up on coffee. But he did a really smart thing: MVC wrapped behind a Facade, the possibility of multi-entity modular constructs. Inspiring. It is likely that I will use it - both for the server backend and for Flash / Air clients.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question