New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@mmuscat/angular-auto

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mmuscat/angular-auto

Auto decorators for Angular

latest
Source
npmnpm
Version
0.1.3
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Auto decorators for Angular

@Auto()
@Component({
   template: `{{ count }}`,
   changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MyComponent {
   @Input()
   count = 0;

   object = new Resource()

   @Subscribe()
   autoIncrement = interval(1000).pipe(
      tap((value) => this.count = value + 1)
   );

   @Unsubscribe()
   subscription = new Subscription();

   ngOnInit() {
      console.log("I am called!")
   }
}
@Auto()
export class Resource {
   private http = inject(HttpClient)

   @Check()
   value

   ngOnInit() {
      console.log("I am also called!")
   }

   fetch(params) {
      this.http.get(endpoint, params)
         .subscribe((value) => this.value = value)
   }
}

Decorators

Auto

Automatically compose the decorated class. Lifecycle hooks cascade to any Auto decorated object created inside a field initializer or class constructor.

Check

Automatically check the decorated value during ngDoCheck and mark the view dirty when it changes. Use with OnPush change detection strategy.

Subscribe

Automatically subscribe to the decorated observable during ngDoCheck and mark the view dirty whenever a value is emitted. Use with OnPush change detection strategy. Assigning new values will automatically cancel the previous subscription. Subscriptions are automatically unsubscribed when the context is destroyed.

Unsubscribe

Automatically unsubscribe the decorated subject or subscription during ngOnDestroy. You must still manually call complete and/or unsubscribe before assigning a new value to prevent memory leaks.

Keywords

Angular

FAQs

Package last updated on 09 Jul 2022

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