Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-simple-switch

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-simple-switch - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

package.json
{
"name": "a-simple-switch",
"version": "0.2.0",
"version": "0.3.0",
"description": "Vanilla JS/CSS Switch UI element",

@@ -5,0 +5,0 @@ "main": "src/javascript/index.js",

# Simple Switch
[![npm version](https://badge.fury.io/js/a-simple-switch.svg)](https://badge.fury.io/js/a-simple-switch)
Simple, accessible, performant implementation of the Switch UI element.
![image](https://user-images.githubusercontent.com/6314286/27006387-34f51ae4-4df0-11e7-903d-f5a05e783d6e.png)
**Features:**

@@ -13,2 +17,3 @@

- [Statistics](#statistics)
- [Installation](#installation)

@@ -22,2 +27,12 @@ - [Installing the Javascript](#installing-the-javascript)

## Statistics
Below are the gzipped sizes of the source files. All measured using an Apache
server and Google Chrome.
| File | Size (after gzip) |
| ---- | ----------------- |
| `SimpleSwitch.css` | 785 bytes |
| `SimpleSwitch.min.js` | 1.4 kilobytes |
## Installation

@@ -24,0 +39,0 @@

@@ -24,4 +24,16 @@ export class Switch {

this.element.insertAdjacentElement('afterend', this.track);
this.updateSize();
}
/**
* Updates the size of the Switch to match the inherited font size.
*/
updateSize() {
const _style = window.getComputedStyle(this.track);
const inheritedFontSize = _style['font-size'];
this.track.style.setProperty('--simple-switch_size', inheritedFontSize);
}
bind() {

@@ -28,0 +40,0 @@ this.track.addEventListener("click", function(e) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc