Skip to content

Conversation

@lwdgit
Copy link

@lwdgit lwdgit commented Apr 3, 2017

  • support function & class
  • add amd & cmd wrap for convience

@skeeto
Copy link
Owner

skeeto commented Apr 5, 2017 via email

@lwdgit
Copy link
Author

lwdgit commented Apr 20, 2017

I write a test, and it seems ok!

var Resurrect = require('resurrect.js')
var necromancer = new Resurrect();
var namespace = {};
namespace.Foo = function() {
    this.bar = true;
    this.getBar = function() {
        return this.bar;
    }
    this.setBar = function(value) {
        return this.bar = value;
    }
};
namespace.Foo2 = class {
    constructor() {
        this.init();
    }
    init() {
        this.inited = true
    }
}
var foo_dead = necromancer.stringify(namespace);
var foo_undead = necromancer.resurrect(foo_dead);
var ins = new foo_undead.Foo();
console.log(ins.bar); // true
ins.setBar(false);
console.log(ins.getBar()); // false

var cls = new foo_undead.Foo2();
console.log(cls.inited); // true

yes, class only support es6

},
"repository": {
"type": "git",
"url": "git+https://github.com/lwdgit/resurrect-js.git"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should replace lwdgit with skeeto (also in two other github urls below)

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.

3 participants