UNPKG

2.28 kBTypeScriptView Raw
1declare module '@ember/debug/container-debug-adapter' {
2 import EmberObject from '@ember/object';
3 import type Owner from '@ember/owner';
4 import type { Resolver } from '@ember/owner';
5 /**
6 @module @ember/debug/container-debug-adapter
7 */
8 /**
9 The `ContainerDebugAdapter` helps the container and resolver interface
10 with tools that debug Ember such as the
11 [Ember Inspector](https://github.com/emberjs/ember-inspector)
12 for Chrome and Firefox.
13
14 This class can be extended by a custom resolver implementer
15 to override some of the methods with library-specific code.
16
17 The methods likely to be overridden are:
18
19 * `canCatalogEntriesByType`
20 * `catalogEntriesByType`
21
22 The adapter will need to be registered
23 in the application's container as `container-debug-adapter:main`.
24
25 Example:
26
27 ```javascript
28 Application.initializer({
29 name: "containerDebugAdapter",
30
31 initialize(application) {
32 application.register('container-debug-adapter:main', require('app/container-debug-adapter'));
33 }
34 });
35 ```
36
37 @class ContainerDebugAdapter
38 @extends EmberObject
39 @since 1.5.0
40 @public
41 */
42 export default class ContainerDebugAdapter extends EmberObject {
43 constructor(owner: Owner);
44 /**
45 The resolver instance of the application
46 being debugged. This property will be injected
47 on creation.
48
49 @property resolver
50 @public
51 */
52 resolver: Resolver;
53 /**
54 Returns true if it is possible to catalog a list of available
55 classes in the resolver for a given type.
56
57 @method canCatalogEntriesByType
58 @param {String} type The type. e.g. "model", "controller", "route".
59 @return {boolean} whether a list is available for this type.
60 @public
61 */
62 canCatalogEntriesByType(type: string): boolean;
63 /**
64 Returns the available classes a given type.
65
66 @method catalogEntriesByType
67 @param {String} type The type. e.g. "model", "controller", "route".
68 @return {Array} An array of strings.
69 @public
70 */
71 catalogEntriesByType(type: string): string[];
72 }
73}