File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ if (macroCondition(isDevelopingApp())) {
1212}
1313
1414setConfig ( {
15- rootElement : 'body' ,
15+ rootElement : config . APP [ 'rootElement' ] as string | undefined ,
1616} ) ;
1717
1818export default class App extends Application {
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import { setConfig } from 'ember-basic-dropdown/config';
33
44// Basic usage:
55setConfig({
6- rootElement: config.APP.rootElement, // Default is 'body' (or '#ember-testing' in tests)
6+ rootElement: config.APP.rootElement, // config.APP.rootElement is by default 'undefined' and '#ember-testing' in tests
77});
88
99// Advanced: If you need to override globally the destination element ID (BasicDropdownWormhole), you can do:
1010setConfig({
1111 destination: 'my-custom-destination-id',
12- rootElement: config.APP.rootElement, // Default is 'body' (or '#ember-testing' in tests)
12+ rootElement: config.APP.rootElement, // config.APP.rootElement is by default 'undefined' and '#ember-testing' in tests
1313});
Original file line number Diff line number Diff line change 11export interface Config {
22 destination ?: string ;
3- rootElement : string ;
3+ rootElement ? : string ;
44}
55
6- let _config : Config = {
7- rootElement : '' ,
8- } ;
9-
10- let configSet = false ;
6+ let _config : Config = { } ;
117
128export function setConfig ( config : Config ) {
13- if ( ! config . rootElement ) {
14- throw new Error (
15- "ember-basic-dropdown: 'rootElement' is required in the config. See installation instructions for more details." ,
16- ) ;
17- }
18-
199 _config = config ;
20- configSet = true ;
2110}
2211
2312export function getConfig ( ) : Config {
24- if ( ! configSet ) {
25- throw new Error (
26- 'ember-basic-dropdown: setConfig was not called before accessing config. See installation instructions for more details.' ,
27- ) ;
28- }
29-
3013 return _config ;
3114}
You can’t perform that action at this time.
0 commit comments