
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@morioh/r-bus
Advanced tools
Sync state to local storage so that it persists through a page refresh. Usage is similar to useState except we pass in a local storage key so that we can default to that value on page load instead of the specified initial value.
React hook to dynamically load multiple external script, css and know when its loaded
npm i @morioh/r-resource
import useResource from "@morioh/r-resource";
const [loading] = useResource([
{
tag: 'link',
id: 'flatpickr-css',
rel: 'stylesheet',
href: 'https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.9/flatpickr.min.css',
},
{
tag: 'script',
id: 'flatpickr-js',
src: 'https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.9/flatpickr.min.js'
}
]);
import { useEffect, useRef } from "react";
import useResource from "@morioh/r-resource";
declare const window: any;
type PlatpickrProps = {
config?: object,
onChange?: any,
onOpen?: any,
onClose?: any,
onMonthChange?: any,
onYearChange?: any,
onReady?: any,
onValueUpdate?: any,
onDayCreate?: any,
onCreate?: any,
onDestroy?: any,
value?: string | any | object | number,
className?: string
}
export default function Flatpickr(props: PlatpickrProps) {
const hooks = ['onChange', 'onOpen', 'onClose', 'onMonthChange', 'onYearChange', 'onReady', 'onValueUpdate', 'onDayCreate'];
const root = useRef(null);
const instance = useRef<any>();
const [loading] = useResource([
{
tag: 'link',
id: 'flatpickr-css',
rel: 'stylesheet',
href: 'https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.9/flatpickr.min.css',
},
{
tag: 'script',
id: 'flatpickr-js',
src: 'https://cdnjs.cloudflare.com/ajax/libs/flatpickr/4.6.9/flatpickr.min.js'
}
]);
useEffect(() => {
if (loading) return;
const config = {
dateFormat: 'U',
altFormat: 'Y-m-d G:i K',
altInput: true,
enableTime: true,
minDate: new Date(),
...props.config,
defaultDate: props.config?.defaultDate || props.value || null
};
hooks.forEach(hook => {
if (props.hasOwnProperty(hook)) {
config[hook] = props[hook]
}
})
instance.current = window.flatpickr(root.current, config);
return () => {
// Clean up the subscription
if (instance.current) {
instance.current.destroy();
instance.current = null;
}
};
}, [loading]);
if (loading) return null;
return <input type="text" ref={root} {...props} />;
}
FAQs
A global event emitter for React.
The npm package @morioh/r-bus receives a total of 10 weekly downloads. As such, @morioh/r-bus popularity was classified as not popular.
We found that @morioh/r-bus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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 how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.