
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
pmx-dataapi
Advanced tools
Basic module to declaratively define components using a data-* API.
HTML:
<div data-api-component=”Example”></div>
JavaScript:
import dataapi from 'pmx-dataapi';
const factories = new Map([['Example', Example]]);
const d = dataapi({
factories
});
const comps = d.start() // comps will refer to a Map with all the initialized components
The module can be used with CommonJS and ES2015 modules.
Yarnyarn add pmx-dataapi
or using NPM
npm install pmx-dataapi --save
const dataapi = require('pmx-dataapi').default;
import dataapi from 'pmx-dataapi';
const factories = new Map([['Example', Example]]);
Where the value Example represents a Factory function, and the Key is a string that is gonna be used to create the relationship between our DOM element and the Factory. You could define as many as you want.
const d = dataapi({
factories
});
In this step if you want to customize the namespace used to define your components, you could include the namespaces property, like so:
const d = dataapi({
namespaces: ['custom']
factories
});
By doing this, you could then define your components like this in your HTML:
<div data-custom-component=”Example”></div>
start() method to boostrap your applicationd.start();
Since all the API method return a Promise, you could do the following:
d.then(function (cmp) {
console.log('initialized Components', cmp);
}).catch(function(e) {
console.log('Something went wrong :(', e)
});
returns: Promise that is gonna resolve to a Map containing all the initialized components
returns: Promise that is gonna resolve to a boolean indicating if the process of stoping all the components was successful
returns: Promise that is gonna resolve to a Map containing all the initialized components
returns: Promise that is gonna resolve to a Map containing all the components that were skipped during the initialization process. This could happens when a component was defined in the HTML using a Factory that hasn't been passed to the dataapi factory.
This library has been written with some ES2015 features that need to be polyfilled:
FAQs
Module to define components through a data-* API
We found that pmx-dataapi 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.