For some reason, I can't get this while-loop to work. The code in the export default class runs once, and I can never call back to it when variables are change from another LWC, and imported back to this file.
My code:
mapping.js
import { LightningElement, wire, api, track } from 'lwc';
import { MapMarkers } from './MapMarkers';
import { SearchString, SearchState, ClickCount } from 'c/mappingBox';
// Global Variables.
let SearchStreet = '1 abc street';
let SearchCity = 'Boston';
export default class Mapping extends LightningElement {
// Method should rerun updating when the button is clicked from the MappingBox.js file; (not working).
SearchClick(event) {
// The address entered into the search bar.
const ArrStreet = SearchString.split(',');
SearchStreet = ArrStreet[0];
// The town or city entered into the search bar.
const ArrCity = SearchString.split(',');
SearchCity = ArrCity[1];
// Updates and locates the location searched.
this.mapMarkers = MapMarkers(SearchCity, SearchState, SearchStreet);
}
// What populates, before searching is done.
mapMarkers = MapMarkers(SearchCity, SearchState, SearchStreet);
// Not working?
while( ClickCount = true ){
this.SearchClick();
ClickCount = false;
}
}
mappingBox
// Function when the search button is clicked.
SearchClick(event) {
SearchString = this.SearchText;
ClickCount = true;
}
More Detail:
"ClickCount" is then export to "mapping.js" file.
For some reason I can't get the method "SearchClick" from the "mapping.js" file to rerun, so the variable can update and output a different location on the mapping function.