How to use the tui-code-snippet.bind function in tui-code-snippet

To help you get started, weโ€™ve selected a few tui-code-snippet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhn / tui.chart / test / components / series / renderingLabelHelper.spec.js View on Github external
it('should make position map having only an end property, if it is not range value.', () => {
            const seriesItem = {
                value: 10
            };
            const bound = {
                left: 30,
                top: 20,
                width: 40,
                height: 50
            };
            const makePosition = snippet.bind(labelHelper._makePositionForBoundType, labelHelper);
            const actual = labelHelper._makePositionMap(seriesItem, bound, 20, {}, makePosition);

            expect(actual.end).toEqual({
                left: 50,
                top: 45
            });
            expect(actual.start).toBeUndefined();
        });
github nhn / tui.chart / src / js / charts / mapChartMapModel.js View on Github external
* @type {{
         *      M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
         *      V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
         * }}
         */
        this.commandFuncMap = {
            M: snippet.bind(this._makeCoordinate, this),
            m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            L: snippet.bind(this._makeCoordinate, this),
            l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            H: snippet.bind(this._makeXCoordinate, this),
            h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
            V: snippet.bind(this._makeYCoordinate, this),
            v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
        };

        /**
         * Ignore command map.
         * @type {{Z: boolean, z: boolean}}
         */
        this.ignoreCommandMap = {
            Z: true,
            z: true
        };

        /**
         * Map dimension
         * @type {{width: number, height: number}}
         */
        this.mapDimension = null;
github nhn / tui.chart / src / js / models / data / dataProcessorBase.js View on Github external
_findSimpleTypeFormatFunctions(format) {
        let funcs = [];
        let len;

        if (this._isDecimal(format)) {
            len = this._pickMaxLenUnderPoint([format]);
            funcs = [snippet.bind(this._formatToDecimal, this, len)];
        } else if (this._isZeroFill(format)) {
            len = format.length;
            funcs = [snippet.bind(this._formatToZeroFill, this, len)];

            return funcs;
        }

        if (this._isComma(format)) {
            funcs.push(renderUtil.formatToComma);
        }

        return funcs;
    }
github nhn / tui.chart / src / js / helpers / eventListener.js View on Github external
_addEventListener(target, type, handler, context) {
        let bindHandler;

        if (context) {
            bindHandler = snippet.bind(handler, context);
        } else {
            bindHandler = handler;
        }

        bindHandlerMap[type + handler] = bindHandler;
        target.addEventListener(type, bindHandler);
    },
github nhn / tui.chart / src / js / charts / mapChartMapModel.js View on Github external
/**
         * Command function map.
         * @type {{
         *      M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
         *      V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
         * }}
         */
        this.commandFuncMap = {
            M: snippet.bind(this._makeCoordinate, this),
            m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            L: snippet.bind(this._makeCoordinate, this),
            l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            H: snippet.bind(this._makeXCoordinate, this),
            h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
            V: snippet.bind(this._makeYCoordinate, this),
            v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
        };

        /**
         * Ignore command map.
         * @type {{Z: boolean, z: boolean}}
         */
        this.ignoreCommandMap = {
            Z: true,
            z: true
        };

        /**
         * Map dimension
         * @type {{width: number, height: number}}
github nhn / tui.chart / src / js / components / legends / spectrumLegend.js View on Github external
_attachToEventBus() {
        this.eventBus.on({
            showWedge: this.onShowWedge,
            hideTooltip: this.onHideWedge
        }, this);
        this.eventBus.on('beforeImageDownload', snippet.bind(this._removeLocationURLFromFillAttribute, this));
        this.eventBus.on('afterImageDownload', snippet.bind(this._restoreLocationURLToFillAttribute, this));
    }
github nhn / tui.chart / src / js / charts / mapChartMapModel.js View on Github external
* Command function map.
         * @type {{
         *      M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
         *      V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
         * }}
         */
        this.commandFuncMap = {
            M: snippet.bind(this._makeCoordinate, this),
            m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            L: snippet.bind(this._makeCoordinate, this),
            l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            H: snippet.bind(this._makeXCoordinate, this),
            h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
            V: snippet.bind(this._makeYCoordinate, this),
            v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
        };

        /**
         * Ignore command map.
         * @type {{Z: boolean, z: boolean}}
         */
        this.ignoreCommandMap = {
            Z: true,
            z: true
        };

        /**
         * Map dimension
         * @type {{width: number, height: number}}
         */
github nhn / tui.chart / src / js / charts / mapChartMapModel.js View on Github external
* @type {{
         *      M: MapChartMapModel._makeCoordinate, m: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      L: MapChartMapModel._makeCoordinate, l: MapChartMapModel._makeCoordinateFromRelativeCoordinate,
         *      H: MapChartMapModel._makeXCoordinate, h: MapChartMapModel._makeXCoordinateFroRelativeCoordinate,
         *      V: MapChartMapModel._makeYCoordinate, v: MapChartMapModel._makeYCoordinateFromRelativeCoordinate
         * }}
         */
        this.commandFuncMap = {
            M: snippet.bind(this._makeCoordinate, this),
            m: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            L: snippet.bind(this._makeCoordinate, this),
            l: snippet.bind(this._makeCoordinateFromRelativeCoordinate, this),
            H: snippet.bind(this._makeXCoordinate, this),
            h: snippet.bind(this._makeXCoordinateFroRelativeCoordinate, this),
            V: snippet.bind(this._makeYCoordinate, this),
            v: snippet.bind(this._makeYCoordinateFromRelativeCoordinate, this)
        };

        /**
         * Ignore command map.
         * @type {{Z: boolean, z: boolean}}
         */
        this.ignoreCommandMap = {
            Z: true,
            z: true
        };

        /**
         * Map dimension
         * @type {{width: number, height: number}}
         */
        this.mapDimension = null;
github nhn / tui.calendar / src / js / view / week / timeGrid.js View on Github external
TimeGrid.prototype.attachEvent = function() {
    clearInterval(this.intervalID);
    clearTimeout(this.timerID);
    this.intervalID = this.timerID = null;

    this.timerID = setTimeout(util.bind(this.onTick, this), (SIXTY_SECONDS - new TZDate().getSeconds()) * 1000);

    domevent.on(this.stickyContainer, 'click', this._onClickStickyContainer, this);
};
github nhn / tui.chart / src / js / components / tooltips / tooltipBase.js View on Github external
* Tooltip container.
         * @type {HTMLElement}
         */
        this.tooltipContainer = null;

        /**
         * Tooltip suffix.
         * @type {string}
         */
        this.suffix = this.options.suffix ? ` ${this.options.suffix}` : '';

        /**
         * Tooltip template function.
         * @type {function}
         */
        this.templateFunc = this.options.template || snippet.bind(this._makeTooltipHtml, this);

        /**
         * Tooltip animation time.
         * @type {number}
         */
        this.animationTime = isPieChart ? chartConst.TOOLTIP_PIE_ANIMATION_TIME : chartConst.TOOLTIP_ANIMATION_TIME;

        /**
         * TooltipBase base data.
         * @type {Array.>}
         */
        this.data = [];

        /**
         * layout bounds information for this components
         * @type {null|{dimension:{width:number, height:number}, position:{left:number, top:number}}}