Created
December 27, 2011 16:04
-
-
Save ppcano/1524133 to your computer and use it in GitHub Desktop.
Observes a view to be notified after DOM insertion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ControlledView = SC.Mixin.create({ | |
isInsertedElement: false, | |
didInsertElement: function(){ | |
set(this, 'isInsertedElement', true); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SC.addObserver(view, 'isInsertedElement' ,function() { | |
var deviceHeight = $(window).height(); | |
..... | |
// Do something | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment