<commit_before>/**
 * Created by lundfall on 10/4/16.
 */
define(function(require, exports, module) {
    var Group = require('./Group.js');

    /**
     * A Context designed to contain surfaces and set properties
     *   to be applied to all of them at once with native scrolling.
     *   This is primarily used for specific performance improvements in the rendering {{.
     *   Private.
     *
     * @private
     * @class NativeScorllGroup
     * @extends Group
     * @constructor
     * @param {Object} [options] Surface options array (see Surface})
     */
    function NativeScrollGroup(options) {
        Group.call(this, options);
    }
    NativeScrollGroup.prototype = Object.create(Group.prototype);

    NativeScrollGroup.prototype.commit = function commit(context) {
        this._surfaceSize = context.size;
        Group.prototype.commit.apply(this, arguments);
    };


    NativeScrollGroup.prototype.elementClass = 'famous-native-scroller';
    module.exports = NativeScrollGroup;
});<commit_msg>Extended functionality of native scroll group<commit_after>/**
 * Created by lundfall on 10/4/16.
 */
define(function (require, exports, module) {
  var Group = require('./Group.js');

  /**
   * A Context designed to contain surfaces and set properties
   *   to be applied to all of them at once with native scrolling.
   *   This is primarily used for specific performance improvements in the rendering {{.
     *   Private.
     *
   * @private
   * @class NativeScorllGroup
   * @extends Group
   * @constructor
   * @param {Object} [options] Surface options array (see Surface})
   */
  function NativeScrollGroup(options) {
    Group.call(this, options);
  }

  NativeScrollGroup.prototype = Object.create(Group.prototype);

  NativeScrollGroup.prototype.commit = function commit(context) {
    this._surfaceSize = context.size;
    this.on('deploy', function () {
      if(this._cachedScrollOffset){
        this.setScrollOffset();
      }
    }.bind(this));
    Group.prototype.commit.apply(this, arguments);
  };

  /**
   * Sets the scroll offset
   * @param offset. Defaults to the old scroll offset that was set when there wasn't any element.
   */
  NativeScrollGroup.prototype.setScrollOffset = function setScrollOffset(offset) {
    var element = this._element;
    if (element) {
      element.scrollTop = offset || this._cachedScrollOffset;
      this._cachedScrollOffset = undefined;
    } else {
      /* Save to cache and set on deploy instead */
      this._cachedScrollOffset = offset;
    }
  };

  NativeScrollGroup.prototype.getScrollOffset = function getScrollOffset() {
    var element = this._element;
    if (element) {
      return element.scrollTop;
    }
    return 0;
  };




  NativeScrollGroup.prototype.elementClass = 'famous-native-scroller';
  module.exports = NativeScrollGroup;
});
{'fraction_non_alphanumeric': 0.10587407667956385, 'fraction_numerical': 0.0038691523039043265, 'mean_word_length': 3.0744985673352434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1757623', 'n_tokens_mistral': 797, 'n_tokens_neox': 766, 'n_words': 219}