Skip to content

Instantly share code, notes, and snippets.

@givanse
Last active May 22, 2016 15:26
Show Gist options
  • Select an option

  • Save givanse/0cea6a415efed18be5a7 to your computer and use it in GitHub Desktop.

Select an option

Save givanse/0cea6a415efed18be5a7 to your computer and use it in GitHub Desktop.

Revisions

  1. givanse renamed this gist Aug 3, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. givanse revised this gist Nov 13, 2014. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Create a mixin and use the code in *after-render.js*
    Create a mixin and use the code in **after-render.js**

    ember generate mixin after-render

    @@ -12,4 +12,6 @@ To use the mixin in a view, do:
    }
    });

    Note: Since 1.8.0-beta.1 the behaviour has changed. Now the event triggers first in the children and from there it bubbles up to the parent. See: https://github.com/emberjs/ember.js/pull/5639
    Note:

    Since 1.8.0-beta.1 the behaviour has changed. Now the event triggers first in the children and from there it bubbles up to the parent. See: https://github.com/emberjs/ember.js/pull/5639
  3. givanse revised this gist Nov 13, 2014. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Create a mixin and use the code in after-render.js
    Create a mixin and use the code in *after-render.js*

    ember generate mixin after-render

    @@ -10,4 +10,6 @@ To use the mixin in a view, do:
    afterRenderEvent: function() {
    // JQuery sauce
    }
    });
    });

    Note: Since 1.8.0-beta.1 the behaviour has changed. Now the event triggers first in the children and from there it bubbles up to the parent. See: https://github.com/emberjs/ember.js/pull/5639
  4. givanse revised this gist Nov 13, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Create a mixin and use the code above (after-render.js)
    Create a mixin and use the code in after-render.js

    ember generate mixin after-render

  5. givanse created this gist Nov 13, 2014.
    13 changes: 13 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    Create a mixin and use the code above (after-render.js)

    ember generate mixin after-render

    To use the mixin in a view, do:

    import AfterRender from '../mixins/after-render';

    export default Ember.View.extend(AfterRender, {
    afterRenderEvent: function() {
    // JQuery sauce
    }
    });
    14 changes: 14 additions & 0 deletions after-render.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    import Ember from 'ember';

    export default Ember.Mixin.create({

    /*
    This hook is guaranteed to be executed when the root element of this view has been inserted into the DOM.
    */
    didInsertElement : function(){
    this._super();
    Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent);
    },

    afterRenderEvent : Ember.K
    });