packages/browser-sync-ui/lib/async.js
function (ui, done) {

        var bs = ui.bs;

        ui.clients.on("connection", function (client) {

            client.emit("ui:connection", ui.options.toJS());

            ui.options.get("clientFiles").map(function (item) {
                if (item.get("active")) {
                    ui.addElement(client, item.toJS());
                }
            });
        });

        ui.socket.on("connection", function (client) {

            client.emit("connection", bs.getOptions().toJS());

            client.emit("ui:connection", ui.options.toJS());

            client.on("ui:get:options", function () {
                client.emit("ui:receive:options", {
                    bs: bs.getOptions().toJS(),
                    ui: ui.options.toJS()
                });
            });

            // proxy client events
            client.on("ui:client:proxy", function (evt) {
                ui.clients.emit(evt.event, evt.data);
            });

            client.on("ui", function (data) {
                ui.delegateEvent(data);
            });
        });
        done();
    }
function (ui, done) {

        var bs = ui.bs;

        ui.clients.on("connection", function (client) {

            client.emit("ui:connection", ui.options.toJS());

            ui.options.get("clientFiles").map(function (item) {
                if (item.get("active")) {
                    ui.addElement(client, item.toJS());
                }
            });
        });

        ui.socket.on("connection", function (client) {

            client.emit("connection", bs.getOptions().toJS());

            client.emit("ui:connection", ui.options.toJS());

            client.on("ui:get:options", function () {
                client.emit("ui:receive:options", {
                    bs: bs.getOptions().toJS(),
                    ui: ui.options.toJS()
                });
            });

            // proxy client events
            client.on("ui:client:proxy", function (evt) {
                ui.clients.emit(evt.event, evt.data);
            });

            client.on("ui", function (data) {
                ui.delegateEvent(data);
            });
        });
        done();
    }
function ( ui , done ) { var bs = ui . bs ; ui . clients . on ( "connection" , function ( client ) { client . emit ( "ui:connection" , ui . options . toJS ( ) ) ; ui . options . get ( "clientFiles" ) . map ( function ( item ) { if ( item . get ( "active" ) ) { ui . addElement ( client , item . toJS ( ) ) ; } } ) ; } ) ; ui . socket . on ( "connection" , function ( client ) { client . emit ( "connection" , bs . getOptions ( ) . toJS ( ) ) ; client . emit ( "ui:connection" , ui . options . toJS ( ) ) ; client . on ( "ui:get:options" , function ( ) { client . emit ( "ui:receive:options" , { bs : bs . getOptions ( ) . toJS ( ) , ui : ui . options . toJS ( ) } ) ; } ) ; // proxy client events client . on ( "ui:client:proxy" , function ( evt ) { ui . clients . emit ( evt . event , evt . data ) ; } ) ; client . on ( "ui" , function ( data ) { ui . delegateEvent ( data ) ; } ) ; } ) ; done ( ) ; }
The most important event is the initial connection where
the options are received from the socket
@param ui
@param done
The most important event is the initial connection where the options are received from the socket