Socket
Socket
Sign inDemoInstall

ngx-observers

Package Overview
Dependencies
5
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ngx-observers

Ngx observers is library to allow developer use Resize, Mutation and Intersection observer api like normal output events on some element.


Version published
Maintainers
1
Install size
160 kB
Created

Readme

Source

Ngx observers

npm version CircleCI GitHub issues npm bundle size NPM docs

Ngx observers is library to allow developer use Resize, Mutation and Intersection observer api like normal output events on some element.

Version compatibility

Angular versionNgx observers version
12, 130.0.0 - 1.x.x
142.x.x
153.x.x

Instalation

npm install ngx-observers --save

then add NgxSimpleTextEditorModule into module imports

import {NgxObserversModule} from "ngx-observers";

@NgModule({
// ...
  imports: [
    // ...
    NgxObserversModule,
    // ...
  ],
// ...
})

Usage

  • ResizeDirective - Allow observe resize event of given object
<div (obsResize)="resize($event)" [obsOptions]="{box: 'content-box'}" #elem="directive">...</div>
<div (obsMutation)="mutate($event)" [obsOptions]="{subtree: false}" #elem="directive">...</div>
  • Intersection directive - Allow observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport
<div (obsIntersection)="intersect($event)" [obsOptions]="{threshold: 0.5}" #elem="directive">...</div>

You can access directive original observer object (e.g. this.obsResize.observer) using template variables (#elem="directive"):

@ViewChild('elem') obsResize: ResizeDirective | undefined;
@ViewChild('elem') obsMutation: MutationDirective | undefined;
@ViewChild('elem') obsIntersection: IntersectionDirective | undefined;

Documentation

See online

License

MIT

Keywords

FAQs

Last updated on 10 Jan 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc