JsBarcode icon indicating copy to clipboard operation
JsBarcode copied to clipboard

more than 1 call to JsBarcode errors api.options(...)[options.format] is not a function

Open EcotechBrad opened this issue 2 years ago • 1 comments

      var upc=new Image()
      new JsBarcode(
        upc,
        "796030114977",
        {
          format: "UPC",
          width: 3,
          height: 80,
        }
      )
      var cno=new Image()
      new JsBarcode(
        cno,
        "796030114977",
        {
          format: "UPC",
          width: 3,
          height: 80,
        }
      )

on the second call i get

runtime-core.esm-bundler.js?5c40:218 Uncaught TypeError: api.options(...)[options.format] is not a function
    at JsBarcode (JsBarcode.js?62c5:76)
    ...

EcotechBrad avatar Feb 01 '22 17:02 EcotechBrad

      var upc=new Image()
      JsBarcode(
        upc,
        "796030114977",
        {
          format: "UPC",
          width: 3,
          height: 80,
        }
      )

      var bc=()=>{
      var cno=new Image()
      JsBarcode(
        cno,
        "796030114977",
        {
          format: "UPC",
          width: 3,
          height: 80,
        }
      )
      };
      bc()

does not throw the error

EcotechBrad avatar Feb 01 '22 17:02 EcotechBrad