Last active
February 17, 2016 18:19
-
-
Save typeoneerror/7dd97911d1226d1b6b10 to your computer and use it in GitHub Desktop.
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
<head> | |
<style id="course-styles"></style> | |
</head> |
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
afterModel(model, transition) { | |
const service = this.get('styleCache'); | |
const course = model.course; | |
const key = `course-${course.get('id')}`; | |
if (service.has_key(key)) { | |
course.set('_styleCache', service.fetch(key)); | |
return RSVP.resolve(); | |
} | |
else { | |
return jQuery.get(course.get('stylesheetUrl')).then((css) => { | |
service.store(key, css); | |
course.set('_styleCache', css); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment