title: Publishing topics in specific widget methods with Dojo
body: <p>I would like to be able to have specific topics published when something happens to a _Templated object.
  Right now, I am simply creating widgets mixing in an extra bit:</p>
  
  <pre><code>[...]
  return declare('hotplate.hotDojoAuth.LoginForm', [_WidgetBase, _TemplatedHooksMixin, _TemplatedMixin, _WidgetsInTemplateMixin ], {
  </code></pre>
  
  <p>_TemplatedHooksMixin simply emits:</p>
  
  <pre><code>define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/topic',
  
    ], function(
      declare
    , lang
    , topic
  
    ){
      return  declare(null, {
  
        templatedHooks: true,
  
        constructor: function(){
          this.templatedHooks = true;
          topic.publish('hotplate/hotHooks/constructor', this);
        },
  
        buildRendering: function(){
          topic.publish('hotplate/hotHooks/buildRendering/before', this);
          this.inherited(arguments);
          topic.publish('hotplate/hotHooks/buildRendering/after', this);
        },
  
        destroyRendering: function(){
          topic.publish('hotplate/hotHooks/destroyRendering/before', this);
          this.inherited(arguments);
          topic.publish('hotplate/hotHooks/destroyRendering/after', this);
        },
  
        postCreate: function(){
          topic.publish('hotplate/hotHooks/postCreate/before', this);
          this.inherited(arguments);
          topic.publish('hotplate/hotHooks/postCreate/after', this);
        },
  
        startup: function(){
          topic.publish('hotplate/hotHooks/startup/before', this);
          this.inherited(arguments);
          topic.publish('hotplate/hotHooks/startup/after', this);
        },
  
        destroy: function(){
          topic.publish('hotplate/hotHooks/destroy/before', this);
          this.inherited(arguments);
          topic.publish('hotplate/hotHooks/destroy/after', this);
        }
  
      });
    }
  );
  </code></pre>
  
  <p>Questions:</p>
  
  <p>1) The code is repeated, mainly because it uses "this", "arguments", "inherited", which all scream "Don't duck with me!" (especially this.inherited). . Any hints on making one function with a simple parameter?</p>
  
  <p>2) Is this a half-sane way of doing it? The idea is to allow other widgets, unrelated to my library, to change the contents of a _Templated widget.</p>
  
  <p>3) If this IS a good path (comments?), do you think the way I am calling the paths is sane?</p>
  
  <p>Thank you!</p>
  
  <p>Merc.</p>