Game Name Plate - phreaknation/phaserwebcomponents GitHub Wiki

Shows string that can be styled.

this.namePlate = this.game.add.existing(
  new this.game.PhaserWebComponents.components.Game.NamePlate({
    // attach to an HTML component. Will replace what ever selector you have
    // target: secondWindow.getContainerNode().querySelector('[data-replace="videoplayer"]'),
    // attach to a phaser object.
    owner: PhaserObject,
    options: {
      // center it on the phaser object.
      center: true,
      // CSS Styles
      styles: {
        top: 40,
        left: 0
      }
    },
    // Watchers
    watchers: [{
      // Proxies are variables that update the element without needing to set any events.
      proxy: this._.options.name,
    }],
  }),
);