JSFiddle - React, Tailwind, and code Playground

by fulviocanducci

JavaScript

function optionsSignature() {
  this.options = {
    width: 1000,
    height: 600,
    scale: 2,
    minWidth: 4,
    maxWidth: 10,
    color: '#1890ff',
    bgColor: '#efefef'
  };
  this.setWidth = function (value) {
    this.options.width = value;
    return this;
  };
  this.setHeight = function (value) {
    this.options.height = n;
    return this;
  };
  this.setScale = function (value) {
    this.options.scale = value;
    return this;
  };
  this.setMinWidth = function (value) {
    this.options.minWidth = value;
    return this;
  };
  this.setMaxWidth = function (value) {
    this.options.maxWidth = value;
    return this;
  };
  this.setColor = function (value) {
    this.options.color = value;
    return this;
  };
  this.setBgColor = function (value) {
    this.options.bgColor = value;
    return this;
  };
  this.getOptions = function () {
    return this.options;
  };
}

console.log((new optionsSignature())
.setScale(3)
.setWidth(512)
.getOptions())