lundi 16 janvier 2017

Specialized Singleton implementation

I am looking for specialized singleton implementation, probably I might be using wrong terminology and hence looking for expert suggestion. Here is my scenario:

There is common code which can be called by ComponentA or ComponentB. I need to push telemetry data from the common code. Telemetry needs to have information that whether this common code get called by ComponentA or ComponentB.

So common code will have just this line of code:

telemetry.pushData(data);

I need to push telemetry data from multiple places so it would be good if object got created once and used through out the code lifetime

One option I can think of passing component context to the common code which in mind doesn't look right, hence looking for suggestion what kind of pattern one should use in this case?

Thanks

Aucun commentaire:

Enregistrer un commentaire