ComponentUrl and Link classes check constructor.name against a string to prevent double initialization of objects, however when used with JS minification the names of the classes is changed and therefore the constructor names no longer match the strings checked against. This results in objects being double initialized and breaking the url passed to historyPushState.
Is there another way to do the check, or do I have to remove it?
Nevermind, I got it.
I think instanceof should work with coffeescript classes although I havent tried it in this case
or if you want to be sure its ComponentUrl and not an object further derived it
X.constructor is ComponentUrl
I was going to go with:
constructor: (@original = document.location.href) ->
return @original if @original.constructor.name is @constructor.name
That work for you?
You should just be able to do. @original.constructor is ComponentUrl
That works too, but it's a comparison of two functions, which seems less efficient than comparing just the names of those functions. So I'm going to go with that. Thanks for bringing this to my attention.
Make class check compatible with uglifier - Fix #346
@reed comparing 2 functions should be more performant than comparing two strings since it should boil down to just a pointer comparison
Based on this argument, I've joined your side.
Changed in c5cda21