Sha256: fd96cba99dff2f85572efd97a88cdf2327c1c4e3611b99e72d2ef4110f15296a

Contents?: true

Size: 1.58 KB

Versions: 12

Compression:

Stored size: 1.58 KB

Contents

if ($.client.android) {
    console.log('=> Using AndroidClient.js');

    // This should be in a mock file...
    if (!window.ClientBridge) {
        window.ClientBridge = {
            notify: function(obj) {
                window.console.debug(obj);
            }
        };
    }

    var Client = Class.extend({
        initialize: function() {

        },
        /**
         * Called by the web application to send values to the client.
         *
         * @param {Object} obj - a set of key/value parameters to send to client
         */
        notify: function(obj) {
            var arr = [];
            for (var prop in obj) {
                arr.push(prop +'='+ encodeURIComponent(obj[prop]));
            }
            ClientBridge.notify( arr.join('&') );
        },

        /**
         * Called by the client to set a value or trigger an action in the web page.
         *
         * @param {String} name
         * @param {Object} value (optional)
         */
        callback: function(name, value) {
            Application.onClientCallback(name, value);
        }
    });

    // Singleton
    Client = new Client();

    // Fix console as it doesn't appear to exist in Android WebView, and we frequently leave these statements in our code
    if (!window.console) {
        window.console = {};
        var f = function() {};
        ["debug", "info", "warn", "error", "assert", "dir", "dirxml", "trace", "group", "groupCollapsed",
        "groupEnd", "time", "timeEnd", "profile", "profileEnd", "count"].forEach(function(func) {
            window.console[func] = f;
        });
    }
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sports_db-0.2 app/assets/javascripts/clients/android/client.js
sports_db-0.0.13 app/assets/javascripts/clients/android/client.js
sports_db-0.1.3 app/assets/javascripts/clients/android/client.js
sports_db-0.1.2 app/assets/javascripts/clients/android/client.js
sports_db-0.1.1 app/assets/javascripts/clients/android/client.js
sports_db-0.1.0 app/assets/javascripts/clients/android/client.js
sports_db-0.0.9 app/assets/javascripts/clients/android/client.js
sports_db-0.0.8 app/assets/javascripts/clients/android/client.js
sports_db-0.0.7 app/assets/javascripts/clients/android/client.js
sports_db-0.0.6 app/assets/javascripts/clients/android/client.js
sports_db-0.0.5 app/assets/javascripts/clients/android/client.js
sports_db-0.0.4 app/assets/javascripts/clients/android/client.js