Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove ReactiveDict values

This is how I define some ReactiveDict variable:

this.templateDictionary = new ReactiveDict();

this.templateDictionary.set( 'type', type );
this.templateDictionary.set( 'size', size );
this.templateDictionary.set( 'bgcolor', bgcolor );
this.templateDictionary.set( 'color', color );

Now I want to remove everything:

this.templateDictionary.set( 'type', undefined );
this.templateDictionary.set( 'size', undefined );
this.templateDictionary.set( 'bgcolor', undefined );
this.templateDictionary.set( 'color', undefined );

But if I do a console.log, I see the variable get the string undefined. So it isn't really removed.

And by the way: Is it possible to set multiple values by one line?

like image 720
user3142695 Avatar asked Dec 27 '25 23:12

user3142695


1 Answers

What you want is:

this.templateDictionary.delete('type');

Though printing it out will still show undefined, but this is normal.

To delete all keys in your dictionary:

this.templateDictionary.clear();

For a list of all the functions in ReactiveDict, check this out.

like image 101
ffxsam Avatar answered Dec 30 '25 11:12

ffxsam