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

Add argument to control whether NamespaceResolver attempts to pair mangled constructors #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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