How to use the @swim/structure.Data.random function in @swim/structure

To help you get started, we’ve selected a few @swim/structure 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 swimos / ripple / ui / main / MirrorView.ts View on Github external
constructor(id?: Value, mode: MirrorMode = MirrorMode.default) {
    super();
    if (id === void 0) {
      id = Text.from(Data.random(6).toBase64());
    }
    this.onMouseDown = this.onMouseDown.bind(this);
    this.onMouseMove = this.onMouseMove.bind(this);
    this.onMouseUp = this.onMouseUp.bind(this);
    this.onTouchStart = this.onTouchStart.bind(this);
    this.onTouchMove = this.onTouchMove.bind(this);
    this.onTouchCancel = this.onTouchCancel.bind(this);
    this.onTouchEnd = this.onTouchEnd.bind(this);
    this.id = id;
    this.mode = mode;
    this.color = Color.fromAny(MirrorView.colors[Math.floor(MirrorView.colors.length * Math.random())]);
    this.captive = false;
    this._touchCount = 0;
    this._presses = {};
  }