-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Update detector.js #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update detector.js #240
Conversation
added findVueRootNode method to avoid prototype.js error vuejs#171
shells/chrome/src/detector.js
Outdated
@@ -5,9 +5,15 @@ window.addEventListener('message', e => { | |||
}) | |||
|
|||
function detect (win) { | |||
function findVueRootNode (array, callback) { | |||
for (let i = 0; i < array.length;i++) { | |||
console.log(array[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it should not be here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, totally, it's from my local test setup O_o
removed the 'console.log' line
is there any more action needed for this change? |
Sorry, I forgot about this. I'll test it and merge this afternoon |
shells/chrome/src/detector.js
Outdated
@@ -5,9 +5,14 @@ window.addEventListener('message', e => { | |||
}) | |||
|
|||
function detect (win) { | |||
function findVueRootNode (array, callback) { | |||
for (let i = 0; i < array.length;i++) { | |||
if (Function.prototype.call(array[i], callback)) return array[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Function.prototype.call
here?
shells/chrome/src/detector.js
Outdated
@@ -5,9 +5,14 @@ window.addEventListener('message', e => { | |||
}) | |||
|
|||
function detect (win) { | |||
function findVueRootNode (array, callback) { | |||
for (let i = 0; i < array.length;i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after second semicolon please :P
fix linting
use .call directly rather than prototype
fixed requested changes |
shells/chrome/src/detector.js
Outdated
@@ -5,9 +5,14 @@ window.addEventListener('message', e => { | |||
}) | |||
|
|||
function detect (win) { | |||
function findVueRootNode (array, callback) { | |||
for (let i = 0; i < array.length; i++) { | |||
if (callback.call(array[i])) return array[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the .call
here either, just callback(array[i])
would do.
BTW The first argument to fn.call()
is the this
context it will be called with.
added findVueRootNode method to avoid prototype.js error
#171