Page 1 of 1

Is there a ***onEnd*** callback function for slideTemporaryObject ?

Posted: 23 March 2021, 10:48
by bidulpik
Hi,
i'm looking for a

onEnd callback function for slideTemporaryObject ?

Like for the dojo/anim function :

onEnd
A callback function which will be executed synchronously when the animation ends.
(https://dojotoolkit.org/reference-guide ... ation.html)

Any idea ?

Re: Is there a ***onEnd*** callback function for slideTemporaryObject ?

Posted: 23 March 2021, 13:37
by Tisaac
Just use this kind of wrapper :

Code: Select all

    slideTemporary(template, data, container, sourceId, targetId, duration, delay = 0) {
    	return new Promise((resolve, reject) => {
    		var animation = this.slideTemporaryObject(this.format_block(template, data), container, sourceId, targetId, duration, delay);
    		setTimeout(() => {
    			resolve();
    		}, duration + delay)
    	});
    },
(using promises instead of callback)

Re: Is there a ***onEnd*** callback function for slideTemporaryObject ?

Posted: 26 March 2021, 20:37
by Volker78
A look at the source reveals:

Code: Select all

 slideTemporaryObject: function(_a79, _a7a, from, to, _a7b, _a7c) {
                        var obj = dojo.place(_a79, _a7a);
                        dojo.style(obj, "position", "absolute");
                        dojo.style(obj, "left", "0px");
                        dojo.style(obj, "top", "0px");
                        this.placeOnObject(obj, from);
                        var anim = this.slideToObject(obj, to, _a7b, _a7c);
                        var _a7d = function(node) {
                            dojo.destroy(node);
                        };
                        dojo.connect(anim, "onEnd", _a7d);
                        anim.play();
                        return anim;
                    },
So a dojo animation object seems to be returned..