Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
window-resize-subject
Advanced tools
[![npm version](https://badge.fury.io/js/window-resize-subject.svg)](https://badge.fury.io/js/window-resize-subject) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) ![CI](https://github.com/mya-ak
Handler for the window resize event of the observer pattern.
npm
$ npm i window-resize-subject
yarn
$ yarn add window-resize-subject
import { WindowResizeSubject } from 'window-resize-subject';
// create subject
const subject = new WindowResizeSubject();
// add observer
const observer = ({ width, height }) => {
// do something
};
subejct.addObserver('name', observer);
// start watching the resize event
subject.subscribe();
note: You can also write in a method chain
subejct.addObserver('name', observer).subscribe();
string
WindowResizeObserver
(event: { width: number, height: number }) => void
Add observer.
subejct.addObserver('name', ({ width, height }) => {
// do something
});
Start watching the resize event.
Stop watching the resize event.
note: observer is not deleted.
Object
number
number
Force update.
subject.notifyObservers({ width: 800, height: 600 });
string
Deletes the specified Observer.
subject.deleteObserver('name');
Deletes all Observers.
number
Changes the delay time for a resize event.
subject.setDelay(100);
returns true if it has an observer.
delay
(option)number
33
Changes the delay time for a resize event.
import { WindowResizeSubject } from 'window-resize-subject';
const subject = new WindowResizeSubject({ delay: 100 });
If you find a bug or want to contribute to the code or documentation, you can help by submitting an issue or a pull request.
FAQs
[![npm version](https://badge.fury.io/js/window-resize-subject.svg)](https://badge.fury.io/js/window-resize-subject) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) ![CI](https://github.com/mya-ak
We found that window-resize-subject demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.