Results 1 to 2 of 2

Thread: What is actually stored when the addHandler is run?

  1. #1
    Join Date
    Aug 2014

    What is actually stored when the addHandler is run?

    I understand that the () around the function in the addHandler causes the code within to be treated as an expression. And that the following () cause the function to be executed with the enclosed argument.

    But I'm stilled confused about when things happen: when the callback is being executed or later.

    What is actually stored when the addHandler is run?

    ... from searchmanager calback function...

    pinInfobox = new Microsoft.Maps.Infobox(pin.getLocation(), {
    title: 'FindIt Pushpin Infobox',
    description: 'This pushpin is located at (' + searchRslt.location.latitude + ', ' + searchRslt.location.longitude + ').',
    visible: false,
    offset: new Microsoft.Maps.Point(searchRslt.location.latitude, searchRslt.location.longitude + 15)

    Microsoft.Maps.Events.addHandler(pin, 'mouseover', (function (e) {
    return function () {

  2. #2
    Join Date
    Aug 2014
    The answer is easily found once you know the key to search for is "nested functions".

    The outer function is executed which means insert the argument and then do the first statement, which is the "return" statement, which returns the inner function with e replaced with pinInfobox.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center