Is there a way or module to attach multiple variables to a layer, so you can pass values between events?
The only variable I can see in default layer is the name property?
There's a custom property for layers which you can define as anything you like.Example here - http://pastebin.com/MJUqE5Gp
You can make up any property on any layer and set it as you wish. Just use the dot syntax after creating the layer to create a new property on the layer object.
great question! i see two different approaches here, are they both valid?
Custom is better because you are sure you won't conflict in the future.
I'd recommend to use function and use it as functionName(layer) if what you want to do is simply save time by applying the same styles to different layers! 😉