2

So i am using Chart.js in an asp.NET web application which is a 3rd party library and when i attempt to bundle i get following in dev tools:

/* Minification failed. Returning unminified contents.
(10,62600-62606): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(10,62688-62694): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(10,75552-75558): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(10,132288-132294): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
(10,132363-132369): run-time error JS1137: 'native' is a new reserved word and should not be used as an identifier: native
 */
/*!
 * Chart.js
 * http://chartjs.org/
 * Version: 2.7.2
 *
 * Copyright 2018 Chart.js Contributors
 * Released under the MIT license
 * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
 */

Now i looked in library and there is following code using e.native which i am trying understand. There is a comment too that states to use e.native for backwards compatibility. Any explanation would be greatly appreciated.

Just to note the library works fine it just fails to bundle.

handleEvent: function(e) {
            var me = this;
            var options = me.options || {};
            var hoverOptions = options.hover;
            var changed = false;

            me.lastActive = me.lastActive || [];

            // Find Active Elements for hover and tooltips
            if (e.type === 'mouseout') {
                me.active = [];
            } else {
                me.active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions);
            }

            // Invoke onHover hook
            // Need to call with native event here to not break backwards compatibility
            helpers.callback(options.onHover || options.hover.onHover, [e.native, me.active], me);

            if (e.type === 'mouseup' || e.type === 'click') {
                if (options.onClick) {
                    // Use e.native here for backwards compatibility
                    options.onClick.call(me, e.native, me.active);
                }
            }

            // Remove styling for last active (even if it may still be active)
            if (me.lastActive.length) {
                me.updateHoverStyle(me.lastActive, hoverOptions.mode, false);
            }

            // Built in hover styling
            if (me.active.length && hoverOptions.mode) {
                me.updateHoverStyle(me.active, hoverOptions.mode, true);
            }

            changed = !helpers.arrayEquals(me.active, me.lastActive);

            // Remember Last Actives
            me.lastActive = me.active;

            return changed;
        }
    });**
4

0 回答 0