Skip to content
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

Duplicated track functions created #11

Open
shaqtsui opened this issue Apr 12, 2014 · 2 comments
Open

Duplicated track functions created #11

shaqtsui opened this issue Apr 12, 2014 · 2 comments

Comments

@shaqtsui
Copy link

Each time extendedFunction invoked, a new track function (line 73) is created to wrap previous one. This is cause the call stack very long after many times invoke.
Below is the call stack after 10 times invoke:

(anonymous function) (ShowcaseCtrl.js:4)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
originalFunction (extendFunction.js:77)
(anonymous function) (angular-requirejs.js:10)
extendedFunction (extendFunction.js:103)
@devinrhode2
Copy link
Owner

That is indeed what happens, do you know of a way to prevent this? Can you group your function extensions into fewer calls, or do you think the library should do this? In chrome the library could increase the number of functions in the stack trace to 20 instead of 10

I also need to document a new style of extending browser defined methods that doesn't require extendFunction.js

alert = message => {
  if ($('#alert').length)  {
    $('#alert').text(message).show()
  } else {
    Window.prototype.alert.call(window, message)
  }
}

@shaqtsui
Copy link
Author

Can we introduce a property as an indicator to see whether this func already enhanced?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants