function UIManager (thread, compositor, renderLoop) {
    this._thread = thread;
    this._compositor = compositor;
    this._renderLoop = renderLoop;

    this._renderLoop.update(this);

    var _this = this;
    this._thread.onmessage = function (ev) {
        var message = ev.data ? ev.data : ev;
        if (message[0] === Commands.ENGINE) {
            switch (message[1]) {
                case Commands.START:
                    _this._engine.start();
                    break;
                case Commands.STOP:
                    _this._engine.stop();
                    break;
                default:
                    console.error(
                        'Unknown ENGINE command "' + message[1] + '"'
                    );
                    break;
            }
        }
        else {
            _this._compositor.receiveCommands(message);
        }
    };
    this._thread.onerror = function (error) {
        console.error(error);
    };
}
The UIManager is being updated by an Engine by consecutively calling its
`update` method. It can either manage a real Web-Worker or the global
FamousEngine core singleton.

@example
var compositor = new Compositor();
var engine = new Engine();

// Using a Web Worker
var worker = new Worker('worker.bundle.js');
var threadmanger = new UIManager(worker, compositor, engine);

// Without using a Web Worker
var threadmanger = new UIManager(Famous, compositor, engine);

@class  UIManager
@constructor

@param {Famous|Worker} thread The thread being used to receive messages
from and post messages to. Expected to expose a WebWorker-like API, which
means providing a way to listen for updates by setting its `onmessage`
property and sending updates using `postMessage`.
@param {Compositor} compositor an instance of Compositor used to extract
enqueued draw commands from to be sent to the thread.
@param {RenderLoop} renderLoop an instance of Engine used for executing
the `ENGINE` commands on.