XF 2.3 XF.extendObject

Hoffi

Well-known member
Im just back into coding and upgrading my projects and starting to remove jQuery (Yeah, good!)

But I am stuck into extending an existing object.

This does not work, whats my mistake?

JavaScript:
    var a = XF.extendObject(XF.AssetUpload, {
        __backup: {
            "ajaxResponse": "_afterAjaxResponseCv6Core"
        },
        ajaxResponse: function (data) {
            console.log("Ajax");
            this._afterAjaxResponseCv6Core(data);
            if (data.path) {
                console.log("inside Ajax");
            }
        }
    });
 
You probably want XF.extend rather than XF.extendObject. The latter is more a helper for more generic JS objects (like jQuery .extend()).
 
Both does not work. But thats related to the fact, that - I have no idea why - the AssetUpload Element is undefined.
 
This is the correct way, I figured it out.

JavaScript:
    XF.AssetUpload = XF.extend(XF.AssetUpload, {
        __backup: {
            "ajaxResponse": "_afterAjaxResponseCv6Core",
            "init": "_initCv6Core"
        },
 
Back
Top Bottom