override-property-read

override-property-read

The override-property-read snippet overrides a property's value on the window object with a set of available properties.

Parameters

Name

Description

Mandatory

property

The name of the property or path (chain of properties separated by dots).

Yes

value

The value to override the property with.

Yes

setConfigurable

Value of the configurable attribute. Defaults to true. Setting to false prevents overwriting.

No

Possible override values

Value

Meaning

undefined


false

false as boolean

true

true as boolean

falseStr

"false" as string

trueStr

"true" as string

null


noopFunc

Function with empty body

trueFunc

Function returning true

falseFunc

Function returning false

emptyArray

Array with no elements

emptyObj

Object with no properties

''

Empty string

positive decimal integer


Any arbitrary string


Filter examples

Filter

Result

override-property-read adConfig undefined

adConfig has the value of undefined.

override-property-read adConfig undefined false

adConfig is undefined and no longer configurable.

override-property-read shouldShowAds falseFunc

shouldShowAds is a function that returns false.

override-property-read config.adCount 0

config.adCount has the value of 0.

Debugging

Message

When

Definition

<<property>> override done

Each time property is read

The property is accessed.

Overrding <<property>> FILTER: override-property-read <<param>>

Before attaching to property

Snippet is taking over the property getter.