Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bind application to start function #188

Merged
merged 2 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions addon/initializers/embedded.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Application from '@ember/application'
import { deprecate } from '@ember/debug'
import { run } from '@ember/runloop'

interface ObjectConfig {
delegateStart?:
Expand Down Expand Up @@ -102,7 +101,7 @@ export function initialize(application: Application): void {
if (embeddedConfig.delegateStart) {
// @ts-ignore: until correct public types are available
application.reopen({
start: run.bind(application, function emberCliEmbeddedStart(config = {}) {
start: function emberCliEmbeddedStart(this: Application, config = {}) {
const _embeddedConfig = Object.assign(
{},
embeddedConfig.config,
Expand All @@ -112,9 +111,11 @@ export function initialize(application: Application): void {
this.register('config:embedded', _embeddedConfig, { instantiate: false })

this.advanceReadiness()
}),
}.bind(application),
})

application.deferReadiness()

} else {
application.register('config:embedded', embeddedConfig.config)
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"module": "es6",
"moduleResolution": "node",
"noEmit": true,
"noEmitOnError": true,
// "noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
Expand Down