Sha256: cfd8ec82c19ff94b36cf9b3ea1ec825f8a8de17edbc928b845a13841c0a7547c

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

var
    esPhinx;


(function($) {
    "use strict";

    $.prototype.extend({

        observe: function(options, callback) {
            var
                observer,

                resolveArguments = function() {
                    if (options) {
                        if (!options.childList ||
                            typeof options.childList != "boolean") {
                            options.childList = true;
                        }

                        if (!options.subtree ||
                            typeof options.subtree != "boolean") {
                            options.subtree = true;
                        }

                        if (!options.characterData ||
                            typeof options.characterData != "boolean") {
                            options.characterData = true;
                        }

                        // if (!options.attributes ||
                        //     typeof options.attributes != "boolean") {
                        //     options.attributes = false;
                        // }

                    }
                },

                iteratorBlock = function(node) {
                    var
                        block = function(mutations) {
                            callback.call(observer, mutations);
                        };

                    observer = new window.MutationObserver(block);

                    observer.observe(node, options);
                };

            if (!callback && typeof options == "function") {
                callback = options;
            }

            resolveArguments();

            this.each(iteratorBlock);

            return this;
        }

    });

}(esPhinx));

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
esphinx-rails-1.1.4 lib/assets/javascripts/esphinx/util/observer.js
esphinx-rails-1.1.3 lib/assets/javascripts/esphinx/util/observer.js