Dojo: how to use own onMove event (overwrite)

In docs it was said that:

onMove(mover, leftTop, e) called during every move notification; should actually move the node; can be overwritten.

but no example how to overwrite it (onMove). Can somebody throw several lines of code to show how it works?




You don't point out which dojo JavaScript class that the onMove function belongs to. However, you have a couple of generic ways to override functions that also applies in your case.

1) Create a new subclass using dojo.declare.

Suppose the JavaScript class name is myClass, you can use

dojo.declare('anotherClass', myClass, {
    onMove : function(mover, leftTop, e) {}   

2) Change the class's prototype using dojo.extend.

dojo.extend(myClass, {
    onMove : function(mover, leftTop, e) {}         

If you only want to override the function for a single instance, set the property directly.

var obj = new myClass();
obj.onMove = function() {};


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.