File tree Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Original file line number Diff line number Diff line change 1
- import { inBrowser , warn , nextTick } from './util/index'
2
1
import config from './config'
2
+ import {
3
+ warn ,
4
+ nextTick ,
5
+ devtools
6
+ } from './util/index'
3
7
4
8
// we have two separate queues: one for directive updates
5
9
// and one for user watcher registered via $watch().
@@ -36,10 +40,8 @@ function flushBatcherQueue () {
36
40
runBatcherQueue ( userQueue )
37
41
// dev tool hook
38
42
/* istanbul ignore if */
39
- if ( process . env . NODE_ENV !== 'production' ) {
40
- if ( inBrowser && window . __VUE_DEVTOOLS_GLOBAL_HOOK__ ) {
41
- window . __VUE_DEVTOOLS_GLOBAL_HOOK__ . emit ( 'flush' )
42
- }
43
+ if ( devtools ) {
44
+ devtools . emit ( 'flush' )
43
45
}
44
46
resetBatcherState ( )
45
47
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import Vue from './instance/vue'
2
2
import directives from './directives/public/index'
3
3
import elementDirectives from './directives/element/index'
4
4
import filters from './filters/index'
5
- import { inBrowser } from './util/index'
5
+ import { inBrowser , devtools } from './util/index'
6
6
7
7
Vue . version = '1.0.15'
8
8
@@ -28,14 +28,15 @@ Vue.options = {
28
28
export default Vue
29
29
30
30
// devtools global hook
31
- /* istanbul ignore if */
32
- if ( process . env . NODE_ENV !== 'production' && inBrowser ) {
33
- if ( window . __VUE_DEVTOOLS_GLOBAL_HOOK__ ) {
34
- window . __VUE_DEVTOOLS_GLOBAL_HOOK__ . emit ( 'init' , Vue )
35
- } else if ( / C h r o m e \/ \d + / . test ( navigator . userAgent ) ) {
36
- console . log (
37
- 'Download the Vue Devtools for a better development experience:\n' +
38
- 'https://github.com/vuejs/vue-devtools'
39
- )
40
- }
31
+ /* istanbul ignore next */
32
+ if ( devtools ) {
33
+ devtools . emit ( 'init' , Vue )
34
+ } else if (
35
+ process . env . NODE_ENV !== 'production' &&
36
+ inBrowser && / C h r o m e \/ \d + / . test ( navigator . userAgent )
37
+ ) {
38
+ console . log (
39
+ 'Download the Vue Devtools for a better development experience:\n' +
40
+ 'https://github.com/vuejs/vue-devtools'
41
+ )
41
42
}
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ export const inBrowser =
6
6
typeof window !== 'undefined' &&
7
7
Object . prototype . toString . call ( window ) !== '[object Object]'
8
8
9
+ export const devtools =
10
+ inBrowser &&
11
+ window . __VUE_DEVTOOLS_GLOBAL_HOOK__
12
+
9
13
export const isIE9 =
10
14
inBrowser &&
11
15
navigator . userAgent . toLowerCase ( ) . indexOf ( 'msie 9.0' ) > 0
You can’t perform that action at this time.
0 commit comments