Skip to content

Commit

Permalink
fix: bind application to start function (#188)
Browse files Browse the repository at this point in the history
* fix: bind `application` to `start` function

Fix #186

* chore: disable `noEmitOnError`
  • Loading branch information
MrChocolatine authored Jun 27, 2022
1 parent 52f7115 commit 70b02bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit 70b02bf

Please sign in to comment.