🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@amedia/user

Package Overview
Dependencies
Maintainers
51
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amedia/user

Client lib for working with aID user and associated data

Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
799
54.55%
Maintainers
51
Weekly downloads
 
Created
Source

amedia-user-js

Its goal is to simplify the complexity of logging in and getting access to user related data.

Usage

Add this project to yours

> npm i @amedia/amedia-user

Setup a listener for the information you need

import {subscribeToUserUpdates} from '@amedia/amedia-user';

subscribeToUserUpdates(['name', 'email'], (attributes) => {
    console.log(attributes);
});

Receiving updates

This callback will be called whenever where are any changes to the properties you have requested, so be prepared to rerender.

Also, your requested properties might not arrive all at once. This callback will be called whenever we get data in from the various services.

Performance

This app aims to be able to deliver a lot of data really fast. Still, we might need to call several services in order to get what you need. We do try to cache whenever this makes sense, please don't ask for data you don't need.

Behind the scenes

There are a few techniques used to avoid overfetching and fetching multiple times when once would do.

Event-based actions

Much like node-userdata-browser/userdata-client did, we utilize events to message that data is being requested. This allowed us to decouple your request from the particular instance that will serve it. This allows us to have this packed loaded by multiple different components across the page, and only process the requests one place. In addition, if the component that's currently processing requests should be unloaded for whatever reason, one of the other instances will automatically take over.

Request deduping

Since we now process from a single instance of the package it's easy to avoid fetching the same resource multiple times.

Caching

Tha app has got few caching mechanisms, through local storage and indexeddb

FAQs

Package last updated on 03 May 2021

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