Skip to content

Commit

Permalink
fix: add ember-1.13 compatibility to @scalvert's fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-north committed Nov 23, 2018
1 parent e8b1633 commit 9d899b6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vendor/document-title/document-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var routeProps = {
// that will be the document title. The `collectTitleTokens` action
// stops bubbling once a route is encountered that has a `title`
// defined.
title: null,
title: null
};

/*
Expand Down Expand Up @@ -70,7 +70,10 @@ routeProps[mergedActionPropertyName] = {
}
})
.then(function(finalTitle) {
let router = getOwner(self).lookup('router:main');
let router =
typeof getOwner === 'function'
? getOwner(self).lookup('router:main')
: self.router;

// Stubbable fn that sets document.title
router.setTitle(finalTitle);
Expand All @@ -85,7 +88,7 @@ routeProps[mergedActionPropertyName] = {
// Continue bubbling.
return true;
}
},
}
};

Ember.Route.reopen(routeProps);
Expand All @@ -108,7 +111,7 @@ Ember.Router.reopen({
} else {
document.title = title;
}
},
}
});

function lookupFastBoot(context) {
Expand Down

0 comments on commit 9d899b6

Please sign in to comment.