View Single Post
01-28-18, 04:42 PM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
You can check p3lims layout.
https://github.com/p3lim-wow/oUF_P3l...P3lim.lua#L610

The factory allows you to register a function that runs on PLAYER_LOGIN which normally activates a style function and spawns all the units you have specified.
p3lim is using one style function for all called Shared but in that style function he has a conditional check for unitspecific. If it matches another subset function will be called for unitspecific settings.

My approach is a little different. I like to have seperate style functions per unit that load a unit specific config and then call a generic style function which is creating all desired elements based on config settings. On top of that I spawn the units directly when the addon is loaded and not on player login.

You would need to do the latter if you have saved variables which load after the addon is executed and before the player is logged in.

You can easily use the factory with my example by enclosing the spawn in a function which you call with the factory.
https://github.com/zorker/rothui/com...c338fbdc454150
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 01-28-18 at 05:16 PM.
  Reply With Quote