Type alias VerseModuleBase<Data, RequireData>

VerseModuleBase<Data, RequireData>: VerseStartResult & {
    avatarChangedListeners: Parameters<EnvAdapter["addAvatarChangedListener"]>[0][];
    domRoot: HTMLElement;
    envAdapter: EnvAdapter;
    otherPersonAvatarChangedListeners: Parameters<EnvAdapter["addOtherPersonAvatarChangedListener"]>[0][];
    textDataChangedListeners: TextDataChangedListener<any>[];
    addTextDataChangedListener(listener) => void;
    getData() => Data & RequireData;
    initialize<D>(gen, options?) => VerseModuleBase<Data & D, Data & D>;
    initialize<D, O>(gen, options) => VerseModuleBase<Data & D, Data & D>;
    putData(appendData) => Data;
    with<D, O>(gen, cb?) => VerseModuleBase<Data & D, Data & D>;
}

Type Parameters

  • Data extends Record<string, any> = {}

  • RequireData extends Record<string, any> = {}

Type declaration

  • avatarChangedListeners: Parameters<EnvAdapter["addAvatarChangedListener"]>[0][]

    EnvAdapter.addTextDataChangedListener

    Example

    avatarChangedListeners.push((avatar) => {
    const meta = player.avatar.vrm?.meta
    console.log(`changed to ${meta?.metaVersion === "0" ? meta.title : meta?.name}`);
    });
  • domRoot: HTMLElement

    DOM element to attach some controls

    Example

    domRoot.appendChild(myDiv);
    
  • envAdapter: EnvAdapter
  • otherPersonAvatarChangedListeners: Parameters<EnvAdapter["addOtherPersonAvatarChangedListener"]>[0][]

    EnvAdapter.addOtherPersonAvatarChangedListener

    Example

    otherPersonAvatarChangedListeners.push((otherPerson) => {
    const meta = otherPerson.avatar?.vrm?.meta
    console.log(`changed to ${meta?.metaVersion === "0" ? meta.title : meta?.name}`);
    });
  • textDataChangedListeners: TextDataChangedListener<any>[]

    See

    addTextDataChangedListener

  • addTextDataChangedListener:function
    • EnvAdapter.addTextDataChangedListener

      Parameters

      Returns void

      Example

      addTextDataChangedListener((otherPerson, data) => {
      console.log(data);
      });
  • getData:function
    • parsed player.getTextData()

      Returns Data & RequireData

  • initialize:function
  • putData:function
    • merging player.setTextData() like player.setTextData({...previousData, ...appendData})

      Parameters

      • appendData: Partial<Data>

      Returns Data

      Example

      putData({ foo: 1 }); // { foo: 1 }
      putData({ bar: 2 }); // { foo: 1, bar: 2 }
      getData(); // { foo: 1, bar: 2 }
  • with:function
    • initialize a module

      Type Parameters

      • D extends Record<string, any>

      • O

      Parameters

      Returns VerseModuleBase<Data & D, Data & D>

      Example

      verseModule.with(micStatus, ({ initialize }) =>
      initialize({ textureUrl: "./asset/ui/mute.png" }),
      )

Generated using TypeDoc