View Single Post
06/14/20, 12:06 PM   #2
Shinni
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 167
EVENT_MANAGER:RegisterForEvent(BarTracker.name, EVENT_ACTION_LAYER_PUSHED, function() BarTracker.toggleVisibility(true) end)

It's basically shorthand for something like below. The only difference is that in the code below, the function has the name TurnOffVisibility, while in the code above, the function is anonymous.

Lua Code:
  1. local function TurnOffVisibility()
  2.     BarTracker.toggleVisibility(true)
  3. end
  4. EVENT_MANAGER:RegisterForEvent(BarTracker.name, EVENT_ACTION_LAYER_PUSHED, TurnOffVisibility)

I suppose "function() BarTracker.toggleVisibility(true) end" might be the same as your JavaScript example? Is "(() => BarTracker.toggleVisibility(true))" a function?
  Reply With Quote