Skip to content
Discussion options

You must be logged in to vote

Hi @tomoverlund 👋

Instead of using .set() which has implicit writable use the .define_own_property_or_throw(), with a PropertyDescriptor (here is an example usage of it

let new_desc = PropertyDescriptorBuilder::new()
.value(value)
.writable(true)
.enumerable(false)
.configurable(true)
.build();
// 3. Perform ! DefinePropertyOrThrow(O, P, newDesc).
self.define_property_or_throw(key, new_desc, context)
, you just need to change the writable to be false and that should do it 😄 )

NOTE: You don't need class.property for that property, what class.property does is install…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tomoverlund
Comment options

@HalidOdat
Comment options

@tomoverlund
Comment options

Answer selected by tomoverlund
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants