File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,15 +18,14 @@ export default {
1818 // addon. Anything not listed here may get optimized away.
1919 addon . publicEntrypoints ( [
2020 'index.js' ,
21- 'helpers/**/*.js' ,
22- 'services/**/*.js' ,
21+ 'helpers/page-title.js' ,
2322 'test-support/index.js' ,
2423 ] ) ,
2524
2625 // These are the modules that should get reexported into the traditional
2726 // "app" tree. Things in here should also be in publicEntrypoints above, but
2827 // not everything in publicEntrypoints necessarily needs to go here.
29- addon . appReexports ( [ 'helpers/**/*.js' , 'services/**/*.js' ] ) ,
28+ addon . appReexports ( [ 'helpers/**/*.js' ] ) ,
3029
3130 // This babel config should *not* apply presets or compile away ES modules.
3231 // It exists only to provide development niceties for you, like automatic
Original file line number Diff line number Diff line change 11import { scheduleOnce } from '@ember/runloop' ;
2- import Service , { service } from '@ember/service' ;
2+ import { service } from '@ember/service' ;
33import { isEmpty } from '@ember/utils' ;
44import { assert } from '@ember/debug' ;
55import type ApplicationInstance from '@ember/application/instance' ;
66import type RouterService from '@ember/routing/router-service' ;
77import type Owner from '@ember/owner' ;
8+ import { setOwner } from '@ember/owner' ;
9+ import { associateDestroyableChild } from '@ember/destroyable' ;
810
911import type {
1012 FastBootDocument ,
@@ -36,10 +38,9 @@ function hasPageTitleConfig(
3638const configKeys = [ 'separator' , 'prepend' , 'replace' ] as const ;
3739
3840/**
39- @class page-title
40- @extends Ember.Service
41+ @internal
4142 */
42- export default class PageTitleService extends Service {
43+ export class PageTitleManager {
4344 @service ( 'router' ) declare router : RouterService ;
4445
4546 // in fastboot context "document" is instance of
@@ -60,7 +61,9 @@ export default class PageTitleService extends Service {
6061 } ;
6162
6263 constructor ( owner : Owner ) {
63- super ( owner ) ;
64+ setOwner ( this , owner ) ;
65+ associateDestroyableChild ( this , owner ) ;
66+
6467 this . _validateExistingTitleElement ( ) ;
6568
6669 if ( hasResolveRegistration ( owner ) ) {
Original file line number Diff line number Diff line change 1- import { service } from '@ember/service' ;
21import Helper from '@ember/component/helper' ;
32import { guidFor } from '@ember/object/internals' ;
43
54import type Owner from '@ember/owner' ;
6- import type PageTitleService from '../services/page-title .ts' ;
5+ import type PageTitleManager from './manager .ts' ;
76import type { PageTitleToken } from '../private-types.ts' ;
87
98export type PageTitleHelperOptions = Pick <
@@ -32,12 +31,14 @@ interface Signature {
3231 * ```
3332 */
3433export default class PageTitle extends Helper < Signature > {
35- @ service ( 'page-title' ) declare tokens : PageTitleService ;
34+ declare tokens : PageTitleManager ;
3635
3736 tokenId = guidFor ( this ) ;
3837
3938 constructor ( owner : Owner ) {
4039 super ( owner ) ;
40+
41+ this . tokens = new PageTitleManager ( owner ) ;
4142 this . tokens . push ( { id : this . tokenId } ) ;
4243 }
4344
Original file line number Diff line number Diff line change 1- import type PageTitleService from './services/page-title.ts' ;
21import type { FastBootDocument } from './private-types.ts' ;
32
43export default interface ServiceRegistry {
5- /**
6- * The service for managing the title of the page.
7- */
8- 'page-title' : PageTitleService ;
94 /**
105 * ⚠️ This service is not provided by ember-page-title,
116 * but is needed by ember-page-title
You can’t perform that action at this time.
0 commit comments