Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ta-dom-components
Advanced tools
A tiny web components library using ta-dom and morphdom
Ta-Dom! Components is a small library that combines some of the best features of the React and Polymer libraries to make writing web components fast, fun, and easy.
Ta-Dom! Components are built a lot like Polymer components, using a class to define your component. However, it also leverages the virtual DOM concept from React to allow writing a pure render function instead of a template (string!) littered with <dom-if>
's and <dom-repeat>
's. This lets you keep your display logic neatly in one place, where you can leverage the full power of javascript.
Like Polymer, Ta-Dom! Components expose their state as local instance properties that can be manipulated however you see fit without having to learn any new api's. Whether you change a property directly, or batch your changes through the inherited setState({key:value})
interface, the Ta-Dom! base class will handle updating your screen for you in a fast and efficient manner thanks to Morphdom.
Unlike React's virtual DOM, in Ta-Dom! you're always dealing with real DOM elements. It's encouraged to use the Ta-Dom! DOM creation library because it's awesome, but you're free to construct your DOM however you see fit. All of the native DOM api's are available.
npm install --save ta-dom-components
// import TaDomElement
import TaDom from './node-modules/ta-dom-components/ta-dom-element.js';
// define your element's class
export class MyElement extends TaDom.TaDomElement {
// define a static getter for your css
// alternatively, return a link() element
static get css() {
return `
:host {
display: block;
background: gray;
}
:host([read]) {
background: green;
}
h1 {
color: brown;
}
article {
background: brown;
color: white;
}
`
}
// define a static getter for your properties
static get properties() {
return {
header:{
value: '',
},
content: {
value: ''
},
read: {
value: false,
reflectToAttribute: true
}
}
}
// a static getter for any attributes you want to observe
static get observedAttributes() {
return ['header', 'content', 'read']
}
// a render function returns the current state of your dom
render() {
return div({class:'wrapper'},
h1(`${this.header}`),
article({'on-click':(event) => this.onClickArticle(event)}, `${this.content}`)
);
}
// event handler called when the article is clicked
onClickArticle(event) {
this.read = true;
}
}
// register your element
TaDom.customElement('my-element', MyElement);
Check out this flash card game built with Ta-Dom! Components
FAQs
another web-component library
We found that ta-dom-components 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 a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.