I unregistered moveend event.

console.log('keyMoveend Unregistered');

What if I need reRegister that event later. What do I have to do? or How can I suspend moveend event temporarily later to use?

  • I see that you don't finish your questions, that's not how it works. If the given answer satisfies you, mark it as correct. – Jonatas Walker Jan 26 '16 at 10:09

As far as I can understand your problem is that you are not able to re-register an event you have unregister. So you register and event, then you unregister it and then you want to register it back.

//So register the movend event like so
//then unregister the event like so
map.un('movend',moveendFn); //
//Then register back the event in the same way you register it

 //And this is the function to use when the event is fired
function moveendFn(){
//do some stuff when map move end

Now if you want to use the map.unByKey(keyMoveend), and not the way I suggest.Do it like so:

//register it. Unless you provide your full code I can only presume you do it that way
keyMoveend = map.on('movend',moveendFn);
//unregiter it
keyMoveend = map.on('movend',moveendFn);
  • Perhaps some more explanation would be helpful? – John Powell Nov 18 '15 at 9:58
  • 1
    To be honest I can not find something more to explain. It is clear that he wants to unregister the key. nothing more. If you think you can give some more explanation and you have the time make an effort and explain it your self. – pavlos Nov 18 '15 at 10:03
  • Yes, I am going to work the way you have suggested. – atemiz88 Nov 18 '15 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.