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

angular-breakpoints

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-breakpoints - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

22

index.js

@@ -28,6 +28,12 @@ "use strict";

exports.breakpointsProvider = function (breakpoints) {
return core_1.provide(BreakpointsService, { useValue: new BreakpointsService(breakpoints) });
return core_1.provide(BreakpointsService, {
useFactory: function (ngZone) {
return new BreakpointsService(ngZone, breakpoints);
},
deps: [core_1.NgZone]
});
};
var BreakpointsService = (function () {
function BreakpointsService(breakpoints) {
function BreakpointsService(ngZone, breakpoints) {
this.ngZone = ngZone;
this.breakpoints = defaultBreakpoints;

@@ -56,3 +62,11 @@ this.setBreakpoints(breakpoints);

var breakpoint = _this.getBreakpoint(size.width);
_this.changesSubject.next(_this.getBreakpointEvent(breakpoint));
if (core_1.NgZone.isInAngularZone()) {
_this.changesSubject.next(_this.getBreakpointEvent(breakpoint));
}
else {
// NgZone doesnt listen to resize window event, so we have to run this in NgZone to run change detection
_this.ngZone.run(function () {
_this.changesSubject.next(_this.getBreakpointEvent(breakpoint));
});
}
});

@@ -95,3 +109,3 @@ };

core_1.Injectable(),
__metadata('design:paramtypes', [Object])
__metadata('design:paramtypes', [Object, Object])
], BreakpointsService);

@@ -98,0 +112,0 @@ return BreakpointsService;

@@ -1,2 +0,2 @@

import { Injectable, provide } from '@angular/core';
import { Injectable, provide, NgZone } from '@angular/core';
import { Observable } from 'rxjs/Observable';

@@ -44,3 +44,9 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject';

return provide(BreakpointsService, { useValue: new BreakpointsService(breakpoints) });
return provide(BreakpointsService, {
useFactory (ngZone) {
return new BreakpointsService(ngZone, breakpoints)
},
deps: [NgZone]
});
}

@@ -59,3 +65,3 @@

constructor (breakpoints?: BreakpointConfig) {
constructor (private ngZone, breakpoints?: BreakpointConfig) {

@@ -91,3 +97,12 @@ this.setBreakpoints(breakpoints);

const breakpoint: string = this.getBreakpoint(size.width);
this.changesSubject.next(this.getBreakpointEvent(breakpoint));
if (NgZone.isInAngularZone()) {
this.changesSubject.next(this.getBreakpointEvent(breakpoint));
}
else {
// NgZone doesnt listen to resize window event, so we have to run this in NgZone to run change detection
this.ngZone.run(() => {
this.changesSubject.next(this.getBreakpointEvent(breakpoint));
});
}
});

@@ -94,0 +109,0 @@ }

2

package.json
{
"name": "angular-breakpoints",
"version": "1.0.1",
"version": "1.0.2",
"description": "Angular 2 service to programmatically listen to breakpoints",

@@ -5,0 +5,0 @@ "main": "index.js",

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