Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private bindEvents() {
const events = Object.keys(NativeFlicking.EVENTS)
.map(key => NativeFlicking.EVENTS[key]);
events.forEach(eventName => {
this.flicking.on(eventName, e => {
e.currentTarget = this;
const emitter = this[eventName]; // Style guide: Event - https://angular.io/guide/styleguide#dont-prefix-output-properties
if (emitter) {
emitter.emit(e);
if (eventName === 'visibleChange') {
const list = this.counter(this.panels.length * (this.flicking.getCloneCount() + 1));
const min = e.range.min;
const max = e.range.max;
const visibles = min >= 0
private $_bindEvents() {
const events = Object.keys(NativeFlicking.EVENTS)
.map(key => NativeFlicking.EVENTS[key]);
events.forEach(eventName => {
this.$_nativeFlicking.on(eventName, e => {
e.currentTarget = this;
// Make events from camelCase to kebab-case
this.$emit(eventName.replace(/([A-Z])/g, "-$1").toLowerCase(), e);
});
});
if (this.options.renderOnlyVisible) {
this.$_nativeFlicking.on(NativeFlicking.EVENTS.VISIBLE_CHANGE, e => {
this.$forceUpdate();
});
}
}
public mounted() {
this.$_pluginsDiffer = new ListDiffer();
this.$_cloneCount = 0;
const options = {...this.options, ...{ renderExternal: true }};
this.$_nativeFlicking = new NativeFlicking(
this.$el as HTMLElement,
{
...options,
framework: "vue",
frameworkVersion: Vue.version,
} as object,
);
const slots = this.$_getSlots();
this.$_slotDiffer = new ListDiffer(slots, vnode => vnode.key!);
this.$_bindEvents();
this.$_checkUpdate();
if (this.options.renderOnlyVisible) {
// Should update once to update visibles
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking from "@egjs/flicking";
// is to through pass Flicking's utils & constants to plugins
const utils = Flicking.utils;
const consts = utils.extend(utils.extend({}, Flicking.consts), {
DIRECTION_NONE: Flicking.DIRECTION_NONE,
DIRECTION_LEFT: Flicking.DIRECTION_LEFT,
DIRECTION_RIGHT: Flicking.DIRECTION_RIGHT,
DIRECTION_UP: Flicking.DIRECTION_UP,
DIRECTION_DOWN: Flicking.DIRECTION_DOWN,
DIRECTION_HORIZONTAL: Flicking.DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: Flicking.DIRECTION_VERTICAL,
DIRECTION_ALL: Flicking.DIRECTION_ALL
});
/**
* Base class to generate flicking plugin
* Lifecycle: componentWillMount --> componentMount --> componentDidMount --> componentWillUnmount
* @ko Flicking 플러그인을 생성하기 위한 기본 클래스
* @alias eg.Flicking.plugin
* @private
*/
export default class Plugin {
/**
* Constructor
* @param {Object} options Option object 옵션 객체
*/
constructor(options = {}) {
this.options = options;
/**
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking from "@egjs/flicking";
// is to through pass Flicking's utils & constants to plugins
const utils = Flicking.utils;
const consts = utils.extend(utils.extend({}, Flicking.consts), {
DIRECTION_NONE: Flicking.DIRECTION_NONE,
DIRECTION_LEFT: Flicking.DIRECTION_LEFT,
DIRECTION_RIGHT: Flicking.DIRECTION_RIGHT,
DIRECTION_UP: Flicking.DIRECTION_UP,
DIRECTION_DOWN: Flicking.DIRECTION_DOWN,
DIRECTION_HORIZONTAL: Flicking.DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: Flicking.DIRECTION_VERTICAL,
DIRECTION_ALL: Flicking.DIRECTION_ALL
});
/**
* Base class to generate flicking plugin
* Lifecycle: componentWillMount --> componentMount --> componentDidMount --> componentWillUnmount
* @ko Flicking 플러그인을 생성하기 위한 기본 클래스
* @alias eg.Flicking.plugin
* @private
*/
export default class Plugin {
/**
* Constructor
* @param {Object} options Option object 옵션 객체
/**
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking from "@egjs/flicking";
// is to through pass Flicking's utils & constants to plugins
const utils = Flicking.utils;
const consts = utils.extend(utils.extend({}, Flicking.consts), {
DIRECTION_NONE: Flicking.DIRECTION_NONE,
DIRECTION_LEFT: Flicking.DIRECTION_LEFT,
DIRECTION_RIGHT: Flicking.DIRECTION_RIGHT,
DIRECTION_UP: Flicking.DIRECTION_UP,
DIRECTION_DOWN: Flicking.DIRECTION_DOWN,
DIRECTION_HORIZONTAL: Flicking.DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: Flicking.DIRECTION_VERTICAL,
DIRECTION_ALL: Flicking.DIRECTION_ALL
});
/**
* Base class to generate flicking plugin
* Lifecycle: componentWillMount --> componentMount --> componentDidMount --> componentWillUnmount
* @ko Flicking 플러그인을 생성하기 위한 기본 클래스
* @alias eg.Flicking.plugin
* @private
*/
export default class Plugin {
/**
* Constructor
* @param {Object} options Option object 옵션 객체
*/
/**
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking from "@egjs/flicking";
// is to through pass Flicking's utils & constants to plugins
const utils = Flicking.utils;
const consts = utils.extend(utils.extend({}, Flicking.consts), {
DIRECTION_NONE: Flicking.DIRECTION_NONE,
DIRECTION_LEFT: Flicking.DIRECTION_LEFT,
DIRECTION_RIGHT: Flicking.DIRECTION_RIGHT,
DIRECTION_UP: Flicking.DIRECTION_UP,
DIRECTION_DOWN: Flicking.DIRECTION_DOWN,
DIRECTION_HORIZONTAL: Flicking.DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: Flicking.DIRECTION_VERTICAL,
DIRECTION_ALL: Flicking.DIRECTION_ALL
});
/**
* Base class to generate flicking plugin
* Lifecycle: componentWillMount --> componentMount --> componentDidMount --> componentWillUnmount
* @ko Flicking 플러그인을 생성하기 위한 기본 클래스
* @alias eg.Flicking.plugin
* @private
*/
export default class Plugin {
/**
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking from "@egjs/flicking";
// is to through pass Flicking's utils & constants to plugins
const utils = Flicking.utils;
const consts = utils.extend(utils.extend({}, Flicking.consts), {
DIRECTION_NONE: Flicking.DIRECTION_NONE,
DIRECTION_LEFT: Flicking.DIRECTION_LEFT,
DIRECTION_RIGHT: Flicking.DIRECTION_RIGHT,
DIRECTION_UP: Flicking.DIRECTION_UP,
DIRECTION_DOWN: Flicking.DIRECTION_DOWN,
DIRECTION_HORIZONTAL: Flicking.DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: Flicking.DIRECTION_VERTICAL,
DIRECTION_ALL: Flicking.DIRECTION_ALL
});
/**
* Base class to generate flicking plugin
* Lifecycle: componentWillMount --> componentMount --> componentDidMount --> componentWillUnmount
* @ko Flicking 플러그인을 생성하기 위한 기본 클래스
* @alias eg.Flicking.plugin
* @private
*/
/**
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking from "@egjs/flicking";
// is to through pass Flicking's utils & constants to plugins
const utils = Flicking.utils;
const consts = utils.extend(utils.extend({}, Flicking.consts), {
DIRECTION_NONE: Flicking.DIRECTION_NONE,
DIRECTION_LEFT: Flicking.DIRECTION_LEFT,
DIRECTION_RIGHT: Flicking.DIRECTION_RIGHT,
DIRECTION_UP: Flicking.DIRECTION_UP,
DIRECTION_DOWN: Flicking.DIRECTION_DOWN,
DIRECTION_HORIZONTAL: Flicking.DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: Flicking.DIRECTION_VERTICAL,
DIRECTION_ALL: Flicking.DIRECTION_ALL
});
/**
* Base class to generate flicking plugin
* Lifecycle: componentWillMount --> componentMount --> componentDidMount --> componentWillUnmount
* @ko Flicking 플러그인을 생성하기 위한 기본 클래스
* @alias eg.Flicking.plugin
* @private
*/
export default class Plugin {
/**
/**
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking from "@egjs/flicking";
// is to through pass Flicking's utils & constants to plugins
const utils = Flicking.utils;
const consts = utils.extend(utils.extend({}, Flicking.consts), {
DIRECTION_NONE: Flicking.DIRECTION_NONE,
DIRECTION_LEFT: Flicking.DIRECTION_LEFT,
DIRECTION_RIGHT: Flicking.DIRECTION_RIGHT,
DIRECTION_UP: Flicking.DIRECTION_UP,
DIRECTION_DOWN: Flicking.DIRECTION_DOWN,
DIRECTION_HORIZONTAL: Flicking.DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: Flicking.DIRECTION_VERTICAL,
DIRECTION_ALL: Flicking.DIRECTION_ALL
});
/**
* Base class to generate flicking plugin
* Lifecycle: componentWillMount --> componentMount --> componentDidMount --> componentWillUnmount
* @ko Flicking 플러그인을 생성하기 위한 기본 클래스
* @alias eg.Flicking.plugin
* @private
*/
export default class Plugin {
/**
* Constructor