1.6.5 • Published 5 years ago

fl_helper v1.6.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

fl_helper

Vanilla ES6 helper collection

npm install fl_helper

Usage

import * as flHelper from 'fl_helper'

Add import 'babel-polyfill' if IE11 support is needed.

Functions

Checks

isEmpty

Detects if a value is truly empty ('', undefined or null). If emptyOutput contains a value, it will be returned if the original value is empty.

flHelper.isEmpty(value, emptyOutput = false)

detectIE

Detects Internet Explorer (any version).

flHelper.detectIE()

detectMobile

Detects mobile devices (screen width under 767px).

flHelper.detectMobile()

Listeners

onScroll

High performance and nonblocking scroll listener.

flHelper.onScroll(scrollTop => {}, container = window)

Extensions

objectAssignDeep

Performs a deep merge (merge with multiple dimensions) of objects and returns a new object. Useful for extending function options.

flHelper.objectAssignDeep(...objects)

scrollIntoViewCenter

Cross-browser function to center an element in the viewport. Also runs the smoothscroll polyfill. The default centerPosition is half the screen height.

flHelper.scrollIntoViewCenter(element, smooth = true, centerPosition = window.innerHeight >> 1)

outerHeight

Returns the element height including margins.

flHelper.outerHeight(element)

File handlers

uploadText

Creates a file upload dialog and returns text in promise.

flHelper.uploadText(type = 'application/json').then(text => {})

downloadText

Downloads text string as a file.

flHelper.downloadText(text, name, type = 'application/json')

Polyfills

smoothscroll

Polyfills window.scroll functions.

flHelper.polyfillSmoothScroll()
1.6.5

5 years ago

1.6.4

5 years ago

1.6.3

5 years ago

1.6.2

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago