Bladeren bron

refactor: use util.isNative to check native Proxy (#7549)

william-pan 8 jaren geleden
bovenliggende
commit
4746256e55
1 gewijzigde bestanden met toevoegingen van 2 en 3 verwijderingen
  1. 2 3
      src/core/instance/proxy.js

+ 2 - 3
src/core/instance/proxy.js

@@ -1,7 +1,7 @@
 /* not type checking this file because flow doesn't play well with Proxy */
 /* not type checking this file because flow doesn't play well with Proxy */
 
 
 import config from 'core/config'
 import config from 'core/config'
-import { warn, makeMap } from '../util/index'
+import { warn, makeMap, isNative } from '../util/index'
 
 
 let initProxy
 let initProxy
 
 
@@ -25,8 +25,7 @@ if (process.env.NODE_ENV !== 'production') {
   }
   }
 
 
   const hasProxy =
   const hasProxy =
-    typeof Proxy !== 'undefined' &&
-    Proxy.toString().match(/native code/)
+    typeof Proxy !== 'undefined' && isNative(Proxy)
 
 
   if (hasProxy) {
   if (hasProxy) {
     const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact')
     const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact')