What is the correct way to “serialize” functions in javascript for later use

后端 未结 7 1555
温柔的废话
温柔的废话 2020-12-17 02:08

I have a \"library\" of objects that I want to load on the fly from a database. Each object comes with its own special functions that are called at specific times depending

7条回答
  •  北海茫月
    2020-12-17 02:48

    A better approach might be to serialize the object's properties when you "sleep" it, and "waking" the object by reattaching its properties to a new instance of the object with the appropriate methods defined.

提交回复
热议问题