title: how to refer to a method or variable from the style function
body: <p>i would like to know how can i refer from the style function to a method or a variable which is declared outside the style function. when i try to use <code>this</code> inside the style function it refers always to the members inside the style function.
  please let me know how to be able to call a method or refer to a variable declared outside the scope of the style function</p>
  <p><strong>code</strong></p>
  <pre><code>return new VectorTileLayer({
      source: new VectorTileSource({
          format: new MVT(),
          url: environment.LHForVectorTileSourceAsMVTTileForZXYWS + zoneToken + &quot;/&quot; + siteId + &quot;/&quot; + threshold + &quot;/&quot; + visualisation_operation_id + &quot;/{z}/{x}/{y}&quot;,
      }),
      opacity: .4,
      style: function (feature){
          // console.log(&quot;MVTTileAsFeature:&quot;,feature)
          let fillColor
          let strokeColor
          let text = &quot;&quot;
          if (feature.get(environment.KEY_OF_MVT_FEATURE_IS_TREATMENT) == true) {
              if (feature.get(environment.KEY_1) &gt;= 0 &amp;&amp; feature.get(environment.KEY_1) &lt;= 12.5){
                  text = feature.get(environment.KEY_1) + &quot;%&quot;
                  fillColor = '#ff0000'
                  strokeColor = '#000000'
              } else if (feature.get(environment.KEY_1) &gt; 12.5 &amp;&amp; feature.get(environment.KEY_1) &lt;= 15) {
                  text = feature.get(environment.KEY_1) + &quot;%&quot;
                  fillColor = '#fd4900'
                  strokeColor = '#000000'
              }
          }
          return new Style({
              fill: new Fill({
                  color: fillColor
                  }),
              stroke: new Stroke({
                  color: strokeColor,
                  lineDash: [1],
                  width:1,
                  }),
                  text: new Text({
                  font: 'Normal 12px Arial',
                  text: ''+text,
                  fill: new Fill({
                      color: '#000000'
                  }),
                  stroke: new Stroke({
                      color: '#000000',
                      width: 0
                  }),
                  // offsetX: -45,
                  // offsetY: 0,
                  // rotation: 0
                  })
              })
      }
      });
  }
  </code></pre>