0

I have a .ts file called Wallblock.ts which has a variable within a function -

export function CreateWalls(): void {


//VIP VARIABLE
var VIPPass: boolean = false;  //Variable true if VIP item held

How would I access the state of this boolean in another .ts file/function - I assume I have to import the variable state somehow from the function CreateWalls? But a total newbie and struggling to work out how?

not sure if it makes any difference but this is for a Decentraland ts project

Have tried using

import { CreateWalls } from './WallBlock';

in the other .ts file

  • 1
    This problem sounds simple but it's actually complicated: you will need to somehow track the status of the internal status `VIPPass` or make it reactive in a way so that it can be observed externally. How is the `VIPPass` value being mutated? A simple way is to simply invoke a function when this value is changed, so that you can use it as a "listener" of sorts. Otherwise you need to use a subscribe/unsubscribe pattern that is way more complicated. – Terry Feb 05 '23 at 22:59

0 Answers0