Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ng-web-apis/mutation-observer

Package Overview
Dependencies
Maintainers
0
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ng-web-apis/mutation-observer

A library for declarative use of Mutation Observer API with Angular

  • 4.11.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.8K
decreased by-22.27%
Maintainers
0
Weekly downloads
 
Created
Source

ng-web-apis logo Mutation Observer API for Angular

Part of > Web APIs for Angular

npm version npm bundle size Travis (.com) codecov angular-open-source-starter

This is a library for declarative use of Mutation Observer API with Angular.

Install

If you do not have @ng-web-apis/common:

npm i @ng-web-apis/common

Now install the package:

npm i @ng-web-apis/mutation-observer

Usage

Add MutationObserverModule and then use (waMutationObserver)="onMutation($event)" directive to watch mutation in an element.

Alternatively use an Observable-based MutationObserverService manually to get MutationObserver in an RxJS Observable form.

Configuring

Use attributes on an element to define MutationObserverInit config object. All attributes are boolean meaning no need to explicitly set them to true.

NOTE: Keep in mind these are used one time in constructor so you cannot use binding, only strings. Pass comma separated attribute names to set attributeFilter array.

Example

<div
  subtree
  childList
  characterData
  attributeFilter="title, aria-label"
  [title]="title"
  [attr.aria-label]="label"
  (waMutationObserver)="onMutation($event)"
>
  ...
</div>

Browser support

IE / EdgeFirefoxChromeSafari
11+14+26+7+

Angular Universal

If you want to use this package with SSR, you need to mock MutationObserver class on the server. You can use our Universal package for this, see this example.

Demo

You can try online demo here

See also

Other Web APIs for Angular by @ng-web-apis

Keywords

FAQs

Package last updated on 14 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc