@gitlab/ui
Version:
GitLab UI Components
89 lines (75 loc) • 2.23 kB
JavaScript
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
var script = {
data: function data() {
return {
appearedAt: null,
now: null,
interval: null
};
},
computed: {
secondsSinceAppearance: function secondsSinceAppearance() {
if (!this.appearedAt) {
return 0;
}
return Math.floor((this.now - this.appearedAt) / 1000);
}
},
destroyed: function destroyed() {
this.clearInterval();
},
methods: {
appear: function appear() {
this.clearInterval();
this.interval = setInterval(this.tick, 1000);
this.tick();
this.appearedAt = this.now;
},
disappear: function disappear() {
this.clearInterval();
},
clearInterval: function (_clearInterval) {
function clearInterval() {
return _clearInterval.apply(this, arguments);
}
clearInterval.toString = function () {
return _clearInterval.toString();
};
return clearInterval;
}(function () {
clearInterval(this.interval);
}),
tick: function tick() {
this.now = new Date().getTime();
}
}
};
/* script */
const __vue_script__ = script;
/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-intersection-observer',{on:{"appear":_vm.appear,"disappear":_vm.disappear}},[_c('span',[_vm._v("Last appeared "+_vm._s(_vm.secondsSinceAppearance)+" seconds ago")])])};
var __vue_staticRenderFns__ = [];
/* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = undefined;
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__ = __vue_normalize__(
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
__vue_inject_styles__,
__vue_script__,
__vue_scope_id__,
__vue_is_functional_template__,
__vue_module_identifier__,
false,
undefined,
undefined,
undefined
);
export default __vue_component__;