How to use the @effectful/serialization.regDescriptor function in @effectful/serialization

To help you get started, we’ve selected a few @effectful/serialization examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awto / effectfuljs / packages / debugger / src / kit.js View on Github external
create() {
      return constr();
    },
    readContent(ctx, json, value) {
      value[metaDataSymbol].$$ = ctx.step(json.$$);
    },
    write(ctx, value) {
      const json = {};
      const proto = value[metaDataSymbol];
      json.$$ = ctx.step(proto.$$, json, "$$");
      return json;
    },
    overrideProps: { [metaDataSymbol]: false },
    typeofHint: "function"
  });
  const frameDescr = S.regDescriptor({
    name: `f@${info.module.name}#${info.name}`,
    readContent(ctx, json, value) {
      value.$ = ctx.step(json.$);
    },
    create(ctx, json) {
      const closure = ctx.step(json.constr);
      const proto = closure[metaDataSymbol];
      return Object.create(proto);
    },
    write(ctx, value) {
      const json = {};
      // json.constr = ctx.step(value.constructor, json, "constr");
      return json;
    }
  });
  function constr($$) {
github awto / effectfuljs / packages / debugger / src / kit.js View on Github external
function wrapMeta(info) {
  const funcDescr = S.regDescriptor({
    name: `p#${info.module.name}#${info.name}`,
    create() {
      return constr();
    },
    readContent(ctx, json, value) {
      value[metaDataSymbol].$$ = ctx.step(json.$$);
    },
    write(ctx, value) {
      const json = {};
      const proto = value[metaDataSymbol];
      json.$$ = ctx.step(proto.$$, json, "$$");
      return json;
    },
    overrideProps: { [metaDataSymbol]: false },
    typeofHint: "function"
  });