AddVar adds a global variable to the jet template set.
(key string, value interface{})
| 179 | |
| 180 | // AddVar adds a global variable to the jet template set. |
| 181 | func (s *JetEngine) AddVar(key string, value interface{}) { |
| 182 | if s.Set != nil { |
| 183 | s.Set.AddGlobal(key, value) |
| 184 | } else { |
| 185 | if s.vars == nil { |
| 186 | s.vars = make(map[string]interface{}) |
| 187 | } |
| 188 | s.vars[key] = value |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | // Reload if setted to true the templates are reloading on each render, |
| 193 | // use it when you're in development and you're boring of restarting |