Synchronization

The synchronization is used for synced the time and user in FrameworkJS with CloadIO.

app.onSynced()

The app.onSynced event is called when the time is synced with CloadIO. Here we can write the codes to get basic data from CloadIO.

  • Type: Function

    app.onSynced = function () {};

  • Example
    Performing an onSynced function configuration inside the app.js:
    // on sync event
    // called when time synced with cloadio
    app.onSynced = function () {
        ref.child('model').get(function (error, value) {
            if (error)
                console.error('get value from cloadio was failed', error);
            else {
                // define local app variable
                if (!app.local.value)
                    app.local.value = {};
                app.local.value = value;
            }
        });
    };