From fc5c04c97e85a120b58107e5b9ee9af68c6b3181 Mon Sep 17 00:00:00 2001 From: Javier Torres Date: Thu, 30 Mar 2017 12:34:32 +0200 Subject: [PATCH] Document events in README --- gears/carto_gears_api/README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gears/carto_gears_api/README.md b/gears/carto_gears_api/README.md index 5a820b0a3c..ddba0441a9 100644 --- a/gears/carto_gears_api/README.md +++ b/gears/carto_gears_api/README.md @@ -91,6 +91,9 @@ Note: YARD support for ERB files is quite limited, and ERBs documentation is sti ### Extension points +Most extension points require a registration during intialization. A good +place to put the code it is inside a file in +config/initializers+. + #### Adding links to profile page See creation at {CartoGearsApi::Pages::SubheaderLink}. @@ -110,4 +113,16 @@ CartoGearsApi::Pages::Subheader.instance.links_generators << lambda do |context| ] end end -``` \ No newline at end of file +``` + +#### Events + +See a list of events at {CartoGearsApi::Events::BaseEvent} and how to subscribe to them with +{CartoGearsApi::Events::EventManager}. +Example: + +```ruby +CartoGearsApi::Events::EventManager.instance.subscribe(CartoGearsApi::Events::UserCreationEvent) do |event| + puts "Welcome #{event.user.username}" +end +```