Skip to content

An unused local variable in the function _doScriptLoaded in define.js #17

@AndyRightNow

Description

@AndyRightNow

The helper function _doScriptLoaded in define.js takes two arguments, but the second argument does not seem to be used while it is always passed every time the function is called.

The source code of the function body is below:

    /**
     * A callback function to call after a script is loaded
     *
     * @param  {Node} _script The loaded script tag
     * @param  {Boolean} _isok Whether the script is successfully loaded or not
     * @return {Void}
     */
    var _doScriptLoaded = function (_script, _isok) {
        var _uri = _doFormatURI(_script.src);

        if (!_uri) return;

        var _arr = __stack.pop();
        if (!!_arr) {
            _arr.unshift(_uri);
            _doDefine.apply(p, _arr);
        }

        if (!!_uri && __scache[_uri] != 1) {
            __scache[_uri] = 2;
        }

        _doClearScript(_script);

        _doCheckLoading();
    };

From this snippet we can see that the argument _isok is not used in any form in this function. Also, in the file define.js we can see there are several times when this function is called with two complete arguments.

E.g.

_doScriptLoaded(_script, !0);

or

_doScriptLoaded(_element, !0);

I find it really confusing. Is this a sort of intentional design with a specific purpose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions