Skip to content

Commit 476bfb5

Browse files
Merge pull request cerebral#296 from FWeinb/future-improve-bundle-size
perf(overmind): completely remove devtools in production
2 parents 7646ea4 + 29bbcc5 commit 476bfb5

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

packages/node_modules/overmind/src/Devtools.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,6 @@ export function safeValues(values) {
3939
return values.map(safeValue)
4040
}
4141

42-
function throttle(func, wait, options?) {
43-
var context, args, result
44-
var timeout: NodeJS.Timeout | null = null
45-
var previous = 0
46-
if (!options) options = {}
47-
var later = function() {
48-
previous = options.leading === false ? 0 : Date.now()
49-
timeout = null
50-
result = func.apply(context, args)
51-
if (!timeout) context = args = null
52-
}
53-
return function() {
54-
var now = Date.now()
55-
if (!previous && options.leading === false) previous = now
56-
var remaining = wait - (now - previous)
57-
context = this
58-
args = arguments
59-
if (remaining <= 0 || remaining > wait) {
60-
if (timeout) {
61-
clearTimeout(timeout)
62-
timeout = null
63-
}
64-
previous = now
65-
result = func.apply(context, args)
66-
if (!timeout) context = args = null
67-
} else if (!timeout && options.trailing !== false) {
68-
timeout = setTimeout(later, remaining)
69-
}
70-
return result
71-
}
72-
}
73-
7442
export class Devtools {
7543
private buffer: string[] = []
7644
private ws: WebSocket

packages/node_modules/overmind/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ export class Overmind<ThisConfig extends IConfiguration>
702702
})
703703
}
704704
private initializeDevtools(host, name, eventHub, initialState, actions) {
705+
if (process.env.NODE_ENV === 'production') return
705706
const devtools = new Devtools(name)
706707
devtools.connect(
707708
host,

0 commit comments

Comments
 (0)