{"repo":"salesforce/observable-membrane","free":true,"listed":false,"github":"https://github.com/salesforce/observable-membrane","clone":"git clone https://github.com/salesforce/observable-membrane.git","description":"A Javascript Membrane implementation using Proxies to observe mutation on an object graph","language":"TypeScript","stars":414,"topics":["proxy","membrane","observe","mutation","read-only","immutable","lwc"],"license":"MIT","category":"networking-infra","readme_excerpt":"Observable Membrane Creating robust JavaScript code becomes increasingly important as web applications become more sophisticated. The dynamic nature of JavaScript code at runtime has always presented challenges for developers. This package implements an observable membrane in JavaScript using Proxies. A membrane can be created to observe access to a module graph and observe what the other part is attempting to do with certain objects. What is a Membrane Tom van Cutsem's original article, \"Isolating application sub-components with membranes\" Tom van Cutsem's original article, \"Membranes in JavaScript\" es-membrane library by Alexander J. Vincent Use Cases One of the prime use-cases for observable membranes is the popular @observed or @tracked decorator used in components to detect mutations on the state of the component to re-render the component when needed. In this case, any object value set into a decorated field can be wrapped into an observable membrane to monitor if the object is accessed during the rendering phase, and if so, the component must be re-rendered when mutations on the object value are detected. And this process is applied not only at the object value level, but at any level in the object graph accessible via the observed object value. Usage The following example illustrates how to create an observable membrane, and proxies: Note: If the value that you're accessing via the membrane is an object that can be observed, then the membrane will return a proxy aroun","default_branch":null,"files":null,"tree":[],"storefront":"/r/salesforce","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/salesforce/observable-membrane/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}