This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/mixins/docking.js.es6

26 lines
691 B
JavaScript

const helper = {
offset: () => window.pageYOffset || $('html').scrollTop()
};
export default Ember.Mixin.create({
_dockHandler: null,
didInsertElement() {
this._super();
// Check the dock after the current run loop since reading sizes is slow
this._dockHandler = () => Ember.run.next(() => this.dockCheck(helper));
$(window).bind('scroll.discourse-dock', this._dockHandler);
$(document).bind('touchmove.discourse-dock', this._dockHandler);
this._dockHandler();
},
willDestroyElement() {
this._super();
$(window).unbind('scroll.discourse-dock', this._dockHandler);
$(document).unbind('touchmove.discourse-dock', this._dockHandler);
}
});