I blogged today about adding a splash screen to an Ember app - here.
The relevant ember code is:
var App = Ember.Application.createWithMixins({
LOG_TRANSITIONS: true,
init: function () {
this.deferReadiness();
this._super();
}
});
App.Router.map(function () {
this.resource('splash');
this.resource('main');
this.resource('sub');
});
App.IndexRoute = Ember.Route.extend({
redirect: function () {
var seenSplash = $.cookie('seen-splash');
if (!seenSplash) {
$.cookie('seen-splash', "true");
this.transitionTo('splash');
} else {
this.transitionTo('main');
}
}
});
App.SplashRoute = Ember.Route.extend({
enter: function () {
var widthOrHeight = $(window).height() > $(window).width() ? 'width' : 'height';
$('#splash-content').find('img').css(widthOrHeight, '70%');
$('#splash').fadeIn();
Ember.run.later(this, function () {
$('#splash').fadeOut().detach();
this.transitionTo('main');
}, 1500);
}
});
App.MainController = Ember.Controller.extend({
clearCookie: function () {
$.cookie('seen-splash', null);
console.log('cleared session cookie');
}
});
App.advanceReadiness();
Posting here for someone who might find it useful.