@@ -15,33 +15,35 @@ var FastBootResponse = require('./fastboot-response');
1515 * @param {Array } [options.hostWhitelist] expected hosts in your application
1616 * @param {Object } [options.metaData] per request meta data
1717 */
18- function FastBootInfo ( request , response , options ) {
18+ class FastBootInfo {
19+ constructor ( request , response , options ) {
20+ this . deferredPromise = RSVP . resolve ( ) ;
21+ let hostWhitelist = options . hostWhitelist ;
22+ let metadata = options . metadata ;
23+ if ( request ) {
24+ this . request = new FastBootRequest ( request , hostWhitelist ) ;
25+ }
1926
20- this . deferredPromise = RSVP . resolve ( ) ;
21- let hostWhitelist = options . hostWhitelist ;
22- let metadata = options . metadata ;
23- if ( request ) {
24- this . request = new FastBootRequest ( request , hostWhitelist ) ;
27+ this . response = new FastBootResponse ( response || { } ) ;
28+ this . metadata = metadata ;
2529 }
2630
27- this . response = new FastBootResponse ( response || { } ) ;
28- this . metadata = metadata ;
29- }
31+ deferRendering ( promise ) {
32+ this . deferredPromise = this . deferredPromise . then ( function ( ) {
33+ return promise ;
34+ } ) ;
35+ }
3036
31- FastBootInfo . prototype . deferRendering = function ( promise ) {
32- this . deferredPromise = this . deferredPromise . then ( function ( ) {
33- return promise ;
34- } ) ;
35- } ;
37+ /*
38+ * Registers this FastBootInfo instance in the registry of an Ember
39+ * ApplicationInstance. It is configured to be injected into the FastBoot
40+ * service, ensuring it is available inside instance initializers.
41+ */
42+ register ( instance ) {
43+ instance . register ( 'info:-fastboot' , this , { instantiate : false } ) ;
44+ instance . inject ( 'service:fastboot' , '_fastbootInfo' , 'info:-fastboot' ) ;
45+ }
46+ }
3647
37- /*
38- * Registers this FastBootInfo instance in the registry of an Ember
39- * ApplicationInstance. It is configured to be injected into the FastBoot
40- * service, ensuring it is available inside instance initializers.
41- */
42- FastBootInfo . prototype . register = function ( instance ) {
43- instance . register ( 'info:-fastboot' , this , { instantiate : false } ) ;
44- instance . inject ( 'service:fastboot' , '_fastbootInfo' , 'info:-fastboot' ) ;
45- } ;
4648
4749module . exports = FastBootInfo ;
0 commit comments