Skip to content

Commit ac855c5

Browse files
Merge pull request cerebral#198 from FWeinb/devtools-argument
use `options.name` as name if provided
2 parents ab176a1 + 8560dea commit ac855c5

File tree

1 file changed

+10
-9
lines changed
  • packages/node_modules/overmind/src

1 file changed

+10
-9
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,14 @@ export class Overmind<Config extends Configuration> implements Configuration {
193193
location.hostname === 'localhost' &&
194194
options.devtools !== false)
195195
) {
196-
this.initializeDevtools(
197-
options.devtools === true ? 'localhost:3031' : options.devtools,
198-
eventHub,
199-
proxyStateTree
200-
)
196+
const host =
197+
options.devtools === true ? 'localhost:3031' : options.devtools
198+
const name =
199+
options.name || typeof document === 'undefined'
200+
? 'NoName'
201+
: document.title || 'NoName'
202+
203+
this.initializeDevtools(host, name, eventHub, proxyStateTree)
201204
} else {
202205
warning +=
203206
'\n\n - You are not running on localhost. You will have to manually define the devtools option to connect'
@@ -500,10 +503,8 @@ export class Overmind<Config extends Configuration> implements Configuration {
500503
return result
501504
})
502505
}
503-
private initializeDevtools(host, eventHub, proxyStateTree) {
504-
const devtools = new Devtools(
505-
typeof document === 'undefined' ? 'NoName' : document.title || 'NoName'
506-
)
506+
private initializeDevtools(host, name, eventHub, proxyStateTree) {
507+
const devtools = new Devtools(name)
507508
devtools.connect(
508509
host,
509510
(message: Message) => {

0 commit comments

Comments
 (0)