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

@xslet/window

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xslet/window

Gets window informations and provide operations related to window.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

@xslet/window Github.io NPM version MIT License

Gets window informations and provide operations related to window.

Build

Build this module:

$ gulp build

Usage

Load this module in a browser:

<script src="xslet.window.min.js"></script>

Use xslet.window.unitOfSize:

xslet.window.unitOfSize = 'rem'
document.getElementById('id1').style.width = 10 + xslet.window.unitOfSize // = '10rem'

Use xslet.window.rootFontSize:

xslet.window.rootFontSize = '3.51mm'
xslet.window.rootFontSize // => about 13 [px]

xslet.window.rootFontSize = 13  // = 13 [px]
document.getElementById('id2').style.fontSize = '2rem' // The element's font size is 26px 

Use xslet.window.convertUnit:

xslet.window.rootFontSize = 13
xslet.window.convertUnit(2, 'rem', 'px') // => 26px

APIs

xslet.window.unitOfSize

The unit which used in xslet modules. This value allowed are 'px', 'mm' and 'rem' and can be set only once.

Type: string

xslet.window.rootFontSize

The font size which is assigned to the HTML element. This value is a number and the unit of this property is 'px', but can be set in unit either 'px' or 'mm' with a string like '10px' or '2mm'.

Type: number

xslet.window.convertUnit(value, fromUnit, toUnit)

Converts value in fromUnit to new value in toUnit. The units allowed are either 'px', 'mm' and 'rem'.

Parameter:

  • value {number} : A value to be converted.
  • fromUnit {string} : The unit of value.
  • toUnit {string} : The unit of value after converted.

Return:

  • {number} : The value after converted.

Test on browsers

Open this page: test/web/index.html.

License

Copyright (C) 2016 Takayuki Sato

This program is free software under MIT License. See the file LICENSE in this distribution for more details.

Keywords

FAQs

Package last updated on 19 Nov 2016

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

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