Skip to content

Conversation

@ZombieProtectionAgency
Copy link

I ran into a few issues with Resurrect-JS while messing with one of my scripts. Enabling variable mangle in uglify mangled constructor names and broke NamespaceResolver. I was going to make my own or manually wrap the internal resolver but I came up with this change to automatically resolve my objects even if I update them later. I think it could be a really useful feature.

I created a couple performance tests here. The (un-uglified) source object I used is below

var TestNamespace = {
    parent: (function() {
        function parent(name) {
            this.children = [];
            this.name = name;
        }

        parent.prototype.addChild = function(childToAdd) {
            this.children.push(childToAdd);
        }

        return parent;
    }()),
    child: (function() {
        function child(parent) {
            this.parent = parent;
        }

        child.prototype.check = function() {
            console.log('Child object check.');
        }

        return child;
    }())
};

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

Successfully merging this pull request may close these issues.

1 participant