mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
after_initialize callback for plugins
This commit is contained in:
parent
ba2c4139fe
commit
6af1e12cc1
2 changed files with 17 additions and 1 deletions
|
@ -67,6 +67,19 @@ class Plugin::Instance
|
|||
File.dirname(path) << "/auto_generated"
|
||||
end
|
||||
|
||||
def after_initialize(&block)
|
||||
@after_initialize ||= []
|
||||
@after_initialize << block
|
||||
end
|
||||
|
||||
def notify_after_initialize
|
||||
if @after_initialize
|
||||
@after_initialize.each do |callback|
|
||||
callback.call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def register_css(style)
|
||||
@styles ||= []
|
||||
@styles << style
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue