Socket
Socket
Sign inDemoInstall

shorter-js

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shorter-js - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

22

dist/shorter-js.js
/*!
* shorter-js v0.0.2 (https://thednp.github.io/shorter-js/)
* shorter-js v0.0.3 (https://thednp.github.io/shorter-js/)
* Copyright 2019-2020 © dnp_theme

@@ -12,2 +12,12 @@ * Licensed under MIT (https://github.com/thednp/shorter-js/blob/master/LICENSE)

var mouseClickEvents = { down: 'mousedown', up: 'mouseup' };
var mouseHoverEvents = ('onmouseleave' in document) ? [ 'mouseenter', 'mouseleave'] : [ 'mouseover', 'mouseout' ];
var touchEvents = { start: 'touchstart', end: 'touchend', move:'touchmove', cancel:'touchcancel' };
var transitionDuration = 'webkitTransition' in document.body.style ? 'webkitTransitionDuration' : 'transitionDuration';
var transitionEndEvent = 'webkitTransition' in document.body.style ? 'webkitTransitionEnd' : 'transitionend';
var support3DTransform = 'webkitPerspective' in document.body.style || 'perspective' in document.body.style;

@@ -63,12 +73,2 @@

var mouseClickEvents = { down: 'mousedown', up: 'mouseup' };
var mouseHoverEvents = ('onmouseleave' in document) ? [ 'mouseenter', 'mouseleave'] : [ 'mouseover', 'mouseout' ];
var touchEvents = { start: 'touchstart', end: 'touchend', move:'touchmove', cancel:'touchcancel' };
var transitionDuration = 'webkitTransition' in document.body.style ? 'webkitTransitionDuration' : 'transitionDuration';
var transitionEndEvent = 'webkitTransition' in document.body.style ? 'webkitTransitionEnd' : 'transitionend';
function getElementTransitionDuration (element) {

@@ -75,0 +75,0 @@ var duration = supportTransition ? window.getComputedStyle(element)[transitionDuration] : 0;

@@ -1,2 +0,2 @@

// shorter-js v0.0.1 | dnp_theme © 2020 | MIT-License
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).SHORTER={})}(this,(function(n){"use strict";var t="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"];function e(n,t,e,o){o=o||!1,n.addEventListener(t,e,o)}function o(n,t,e,o){o=o||!1,n.removeEventListener(t,e,o)}function i(n,t,i,s){e(n,t,(function e(r){r.target===n&&(i(r),o(n,t,e,s))}),s)}var s=function(){var n=!1;try{var t=Object.defineProperty({},"passive",{get:function(){n=!0}});i(document,"DOMContentLoaded",(function(){}),t)}catch(n){}return n}(),r=!!s&&{passive:!0},u="webkitTransform"in document.body.style||"transform"in document.body.style,a="webkitTransition"in document.body.style||"transition"in document.body.style,c="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",d="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration";function f(n){var t=a?window.getComputedStyle(n)[d]:0;return t="number"!=typeof(t=parseFloat(t))||isNaN(t)?0:1e3*t}n.addClass=function(n,t){n.classList.add(t)},n.emulateTransitionEnd=function(n,t){var e=0;f(n)?i(n,c,(function(n){!e&&t(n),e=1})):setTimeout((function(){!e&&t(),e=1}),17)},n.getElementTransitionDuration=f,n.hasClass=function(n,t){return n.classList.contains(t)},n.mouseEvents={down:"mousedown",up:"mouseup"},n.mouseHover=t,n.off=o,n.on=e,n.one=i,n.passiveHandler=r,n.removeClass=function(n,t){n.classList.remove(t)},n.supportPassive=s,n.supportTransform=u,n.supportTransitions=a,n.touchEvents={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},n.transitionDuration=d,n.transitionEndEvent=c,Object.defineProperty(n,"__esModule",{value:!0})}));
// shorter-js v0.0.3 | dnp_theme © 2020 | MIT-License
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).SHORTER={})}(this,(function(e){"use strict";var n="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitTransition"in document.body.style?"webkitTransitionDuration":"transitionDuration",o="webkitTransition"in document.body.style?"webkitTransitionEnd":"transitionend",i="webkitPerspective"in document.body.style||"perspective"in document.body.style;function s(e,n,t,o){o=o||!1,e.addEventListener(n,t,o)}function r(e,n,t,o){o=o||!1,e.removeEventListener(n,t,o)}function u(e,n,t,o){s(e,n,(function i(s){s.target===e&&(t(s),r(e,n,i,o))}),o)}var a=function(){var e=!1;try{var n=Object.defineProperty({},"passive",{get:function(){e=!0}});u(document,"DOMContentLoaded",(function(){}),n)}catch(e){}return e}(),c="webkitTransform"in document.body.style||"transform"in document.body.style,d="webkitTransition"in document.body.style||"transition"in document.body.style;function m(e){var n=d?window.getComputedStyle(e)[t]:0;return n="number"!=typeof(n=parseFloat(n))||isNaN(n)?0:1e3*n}var f=!!a&&{passive:!0};e.addClass=function(e,n){e.classList.add(n)},e.emulateTransitionEnd=function(e,n){var t=0;m(e)?u(e,o,(function(e){!t&&n(e),t=1})):setTimeout((function(){!t&&n(),t=1}),17)},e.getElementTransitionDuration=m,e.hasClass=function(e,n){return e.classList.contains(n)},e.mouseClickEvents={down:"mousedown",up:"mouseup"},e.mouseHoverEvents=n,e.off=r,e.on=s,e.one=u,e.passiveHandler=f,e.queryElement=function(e,n){var t=n&&n instanceof Element?n:document;return e instanceof Element?e:t.querySelector(e)},e.removeClass=function(e,n){e.classList.remove(n)},e.support3DTransform=i,e.supportPassive=a,e.supportTransform=c,e.supportTransition=d,e.touchEvents={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},e.transitionDuration=t,e.transitionEndEvent=o,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "shorter-js",
"version": "0.0.2",
"version": "0.0.3",
"description": "A small ES6/ES7 library with various JavaScript tools useful for creating light libraries.",

@@ -9,3 +9,3 @@ "main": "dist/shorter-js.js",

"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup --environment FORMAT:umd,MIN:false -c",
"build": "rollup --environment FORMAT:umd,MIN:false -c && rollup --environment FORMAT:umd,MIN:true -c",
"min": "rollup --environment FORMAT:umd,MIN:true -c"

@@ -12,0 +12,0 @@ },

@@ -100,8 +100,8 @@ # shorter-js

// EXAMPLES
import {on,off,one,mouseEvents,touchEvents,passiveHandler} from 'shorter-js'
import {on,off,one,mouseClickEvents,touchEvents,passiveHandler} from 'shorter-js'
// attach a passive mousedown eventHandler
on(targetElement,mouseEvents.down,eventHandler,passiveHandler)
on(targetElement,mouseClickEvents.down,eventHandler,passiveHandler)
// detach a passive mousedown eventHandler
off(targetElement,mouseEvents.down,eventHandler,passiveHandler)
off(targetElement,mouseClickEvents.down,eventHandler,passiveHandler)
// attach a single instance passive mousedown eventHandler

@@ -108,0 +108,0 @@ one(targetElement,touchEvents.start,eventHandler,passiveHandler)

@@ -0,1 +1,8 @@

// strings FIRST
export {mouseClickEvents} from './strings/mouseClickEvents.js'
export {mouseHoverEvents} from './strings/mouseHoverEvents.js'
export {touchEvents} from './strings/touchEvents.js'
export {transitionDuration} from './strings/transitionDuration.js'
export {transitionEndEvent} from './strings/transitionEndEvent.js'
// boolean

@@ -17,9 +24,2 @@ export {support3DTransform} from './boolean/support3DTransform.js'

// strings
export {mouseClickEvents} from './strings/mouseClickEvents.js'
export {mouseHoverEvents} from './strings/mouseHoverEvents.js'
export {touchEvents} from './strings/touchEvents.js'
export {transitionDuration} from './strings/transitionDuration.js'
export {transitionEndEvent} from './strings/transitionEndEvent.js'
// misc

@@ -26,0 +26,0 @@ export {emulateTransitionEnd} from './misc/emulateTransitionEnd.js'

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