Sha256: ce6b34333ab05d92cac3a31449e0c1af96f6c4493cdde9b186e9609ca17f1f0c

Contents?: true

Size: 980 Bytes

Versions: 1

Compression:

Stored size: 980 Bytes

Contents

//     Emerson Sink
//
//     Adds...

(function(ns) {

  // Emerson Extension
  // --------------------------------------------------------------------------

  // ### Emerson.sink module
  var define = ns.sink = function(view) {};

  // ### Module API
  //   * `ns` is a reference to the namespace.
  //   * `init` is a hook for initializing the module.
  _.extend(define, {
    ns     : ns,
    init   : function init() {}
  });


  // "Base" Libary Extension
  // --------------------------------------------------------------------------

  // Make a local copy of Emerson.base. e.g., one of jQuery, Zepto or Ender.
  var $ = ns.base;

  // ### $.fn.sink
  //
  //     $(target).sink()
  //
  $.fn.sink = function() {
    _.each(this, function(e) {
      var elem = $(e);
      var key  = elem.data('sink');

      if(key) {
        elem.replaceAll('[data-sink="' + key + '"]', 'body');
        elem.trigger('sink:after');
      }
    });

    return this;
  };
})(Emerson);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
emerson-0.0.4 vendor/assets/javascripts/emerson/sink.js