Skip to content

Support custome object #48

Description

@harvey-woo

Add support for serialization and deserialization of custom objects via Object.assign and Object.create
For example:

class A {
    a = 1
}
serialize(A, { classes: { A } })

get

const serialized = "(function(args) {var k = args[0].classes;return args[0].assign(Object.create(k.A.prototype), { a: 1 })})(arguments)"
function unserialize() {
    return eval(serialized)
}
unserialize({ classes: {A: function() {}}, assign: Object.assign })

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions