@pluginjs/dom
Advanced tools
Comparing version 0.0.5 to 0.0.7
@@ -10,5 +10,5 @@ { | ||
"dependencies": { | ||
"@pluginjs/utils": "^0.2.11" | ||
"@pluginjs/utils": "^0.2.13" | ||
}, | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"description": "A flexible modern date-picker js plugin.", | ||
@@ -15,0 +15,0 @@ "author": "Creation Studio Limited", |
@@ -15,3 +15,3 @@ import { curry } from '@pluginjs/utils' | ||
function step (timestamp) { | ||
function step(timestamp) { | ||
if (!start) { | ||
@@ -18,0 +18,0 @@ start = timestamp |
@@ -21,7 +21,7 @@ import { curry } from '@pluginjs/utils' | ||
export class Functor { | ||
constructor (value) { | ||
constructor(value) { | ||
this.value = value | ||
} | ||
fmap (f) { | ||
fmap(f) { | ||
return new Functor(f(this.value)) | ||
@@ -32,7 +32,7 @@ } | ||
export class Applicative extends Functor { | ||
pure () {} | ||
pure() {} | ||
} | ||
export class Monoids extends Applicative { | ||
join () { | ||
join() { | ||
return this.val | ||
@@ -43,3 +43,3 @@ } | ||
export class Monad extends Monoids { | ||
flatMap () {} | ||
flatMap() {} | ||
} |
@@ -66,3 +66,3 @@ import { parent } from '@pluginjs/dom/html' | ||
class EventStorage { | ||
constructor (element) { | ||
constructor(element) { | ||
this.element = element | ||
@@ -72,3 +72,3 @@ this.listeners = {} | ||
on ({ identity, handler, eventName, namespace }) { | ||
on({ identity, handler, eventName, namespace }) { | ||
this.ensureHandler(handler) | ||
@@ -87,3 +87,3 @@ | ||
once ({ identity, handler, eventName, namespace }) { | ||
once({ identity, handler, eventName, namespace }) { | ||
this.ensureHandler(handler) | ||
@@ -104,3 +104,3 @@ | ||
off (_eventName, handler) { | ||
off(_eventName, handler) { | ||
if (typeof handler === 'undefined') { | ||
@@ -112,3 +112,3 @@ return this.removeAllListeners(_eventName) | ||
trigger (eventName, data) { | ||
trigger(eventName, data) { | ||
const event = new CustomEvent(eventName, { | ||
@@ -120,3 +120,3 @@ detail: data | ||
clear () { | ||
clear() { | ||
Object.entries(this.listeners).map(([key, value]) => { | ||
@@ -129,3 +129,3 @@ this.deleteEventListener(key) | ||
removeListener (_eventName, handler) { | ||
removeListener(_eventName, handler) { | ||
const [eventName, namespace] = _eventName.split('.') | ||
@@ -165,3 +165,3 @@ // .example || click || click.example | ||
removeAllListeners (_eventName) { | ||
removeAllListeners(_eventName) { | ||
const [eventName, namespace] = _eventName.split('.') | ||
@@ -194,3 +194,3 @@ // .example || click || click.example | ||
createEventListener (eventName) { | ||
createEventListener(eventName) { | ||
this.listeners[eventName] = [] | ||
@@ -200,3 +200,3 @@ this.element.addEventListener(eventName, dispatch, false) | ||
deleteEventListener (eventName) { | ||
deleteEventListener(eventName) { | ||
this.element.removeEventListener(eventName, dispatch) | ||
@@ -206,3 +206,3 @@ delete this.listeners[eventName] | ||
checkRepeats (eventName, handler) { | ||
checkRepeats(eventName, handler) { | ||
return ( | ||
@@ -214,3 +214,3 @@ this.listeners[eventName].filter(value => value.handler === handler) | ||
hasListeners (eventName) { | ||
hasListeners(eventName) { | ||
if ( | ||
@@ -226,3 +226,3 @@ !this.listeners[eventName] || | ||
ensureHandler (handler) { | ||
ensureHandler(handler) { | ||
const type = typeof handler | ||
@@ -237,3 +237,3 @@ if (type === 'function') { | ||
static of ({ type: _eventName, identity, handler }, element) { | ||
static of({ type: _eventName, identity, handler }, element) { | ||
if (!element.__eventStorage) { | ||
@@ -255,3 +255,3 @@ element.__eventStorage = new this(element) | ||
static once ({ type: _eventName, identity, handler }, element) { | ||
static once({ type: _eventName, identity, handler }, element) { | ||
if (!element.__eventStorage) { | ||
@@ -273,3 +273,3 @@ element.__eventStorage = new this(element) | ||
static delete (options, element) { | ||
static delete(options, element) { | ||
const eventStorage = this.getEventStorage(element) | ||
@@ -284,3 +284,3 @@ if (!eventStorage) { | ||
static getEventStorage (element) { | ||
static getEventStorage(element) { | ||
return element.__eventStorage | ||
@@ -287,0 +287,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { curry, compose, camelize } from '@pluginjs/utils' | ||
import { curry, compose } from '@pluginjs/utils' | ||
import is from '@pluginjs/is' | ||
@@ -39,18 +39,2 @@ | ||
export const FilterFromData = (dataAttr, value = true, elements) => | ||
elements.filter(item => { | ||
let VerifiData = dataAttr.split('-') | ||
VerifiData.shift() | ||
VerifiData = VerifiData.join('-') | ||
const attr = item.dataset[camelize(VerifiData, false)] | ||
if (value === true) { | ||
if (attr) { | ||
return item | ||
} | ||
} else { | ||
return attr == value | ||
} | ||
}) | ||
export const attrVerify = (attrName, value, el) => { | ||
@@ -65,3 +49,3 @@ const Obj = { | ||
if (v) { | ||
return element.dataset[key] == v | ||
return element.dataset[key] === v | ||
} | ||
@@ -115,4 +99,4 @@ return true | ||
export const Each = (obj, callback) => { | ||
let length, | ||
i = 0 | ||
let i = 0, | ||
length | ||
@@ -119,0 +103,0 @@ if (is.array(obj)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23363
785
Updated@pluginjs/utils@^0.2.13