Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@xslet/window
Advanced tools
Gets window informations and provide operations related to window.
Executes following command to install this package from npm.
$ npm install --save @xslet/window
<script src="xslet.window.min.js"></script>
xslet.window.unitOfSize = 'rem'
This property can be set only once before it is used.
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
This property is a number, but can be set a string which consists of a number and a unit (like '2.5mm'). The unit can be set: px
, mm
or rem
.
xslet.window.rootFontSize = 13
xslet.window.convertUnit(2, 'rem', 'px') // => 26px
xslet.window.scrollbarWidth // => 17, on IE11
Since this property uses .unitOfSize
as the unit, this value is also determined with .unitOfSize
.
Some browsers changes its scroll bar width by zooming (to keep appearance width of its scroll bar). This property solves the change by re-calculating when window contents are re-layouted.
xslet.window.addRelayoutListener(function(event) {
console.log('re-layout window contents! : (' + event.width + ', ' + event.height + ')');
})
The listener function is called everytime the browser is resized, but the times of calling are much less than the number of resize events.
A re-layout listener function is passed an argument of which properties are .width
and .height
, which is inner width and height of a window.
For the unit of these values, .unitOfSize
is used.
xslet.window.relayout()
This code calls re-layout listener functions manually.
Is used in whole of xslet modules.
This value allowed are 'px'
, 'mm'
and 'rem'
and can be set only once.
Type: string
Is assigned to the HTML element.
This value is a number and the unit is 'px'
, but can be set in unit either
'px'
or 'mm'
with a string like '10px'
or '2mm'
.
Type: number
Is the scroll bar width.
The unit of this value is xslet.window.unitOfSize
.
This value is re-calculated when window contents are re-layouted, because some browsers change their scroll bar widths by zooming.
Type: number
Is the delay time of re-layouting against resize events. The unit of this value is milli-second.
Type: number
Converts a value between specified units.
The units can be specified among 'px'
, 'mm'
and 'rem'
.
Parameters:
Return:
Adds a listener function to be called when window contents are re-layouted. Re-layouting window contents are made done at the times of first viewing, window resizing, changing a part of view, and so on.
Parameters:
listener {function} : A listener function. This function has an event object as an argument of which properties are follows:
xslet.window.unitOfSize
.xslet.window.unitOfSize
.Removes a listener function for re-layout.
Parameters:
Executes re-layout event listener functions manually.
Show this page: test/web/index.html.
Copyright (C) 2016 Takayuki Sato
This program is free software under MIT License. See the file LICENSE in this distribution for more details.
FAQs
Gets window informations and provide operations related to window.
The npm package @xslet/window receives a total of 2 weekly downloads. As such, @xslet/window popularity was classified as not popular.
We found that @xslet/window 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.