πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
DemoInstallSign in
Socket

vue-observable

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-observable

Vue Components for the IntersectionObserver, MutationObserver and ResizeObserver APIs

0.1.4
latest
Source
npm
Version published
Weekly downloads
4
-69.23%
Maintainers
1
Weekly downloads
Β 
Created
Source

vue-observable

npm vue2

Abstract Vue Components to utilizing the IntersectionObserver, MutationObserver and ResizeObserver Browser APIs

πŸ”₯ Please keep in mind that you will need polyfills

πŸ”§ Installation

npm install --save vue-observable

πŸ‘ˆ Usage

Componentlist

Bundler (Webpack, Rollup)

import Vue from 'vue'
import VueObservable from 'vue-observable'

Vue.use(VueObservable)

or

import {Intersect, Mutation, Resize} from 'vue-observable'

export default {
  components: {Intersect, Mutation, Resize}
}

Browser

<!-- Include after Vue -->
<!-- Local files -->
<script src="vue-observable/dist/vue-observable.js"></script>

<!-- From CDN -->
<script src="https://unpkg.com/vue-observable"></script>

πŸ“’ Components

IntersectionObserver - <intersect>

The <intersect> component will detect if a given element is in the viewport. And emit an event.

Props

PropRequiredDefault
rootnonull
rootMarginno0px 0px 0px 0px
thresholdno[0, 0.2]

Events

  • enter
  • leave
  • change

Usage

<intersect @enter="enterMethod" @leave="leaveMethod" @change="changeMethod">
  <some-component-or-node>
</intersect>

MutationObserver - <Mutation>

Props

PropRequiredDefault
attributeFilternonull
attributeOldValuenonull
attributesnofalse
characterDatanonull
characterDataOldValuenonull
childListnofalse
subtreenofalse

Events

  • mutation

Usage

<mutation @mutation="mutationMethod">
  <some-component-or-node>
</mutation>

ResizeObserver - <resize>

Props

N/A

Events

  • resize

Usage

<resize @resize="resizeMethod">
  <some-component-or-node>
</resize>

Development

Launch visual tests

npm run dev

Launch Karma with coverage

npm run dev:coverage

Build

Bundle the js and css of to the dist folder:

npm run build

Publishing

The prepublish hook will ensure dist files are created before publishing. This way you don't need to commit them in your repository.

# Bump the version first
# It'll also commit it and create a tag
npm version
# Push the bumped package and tags
git push --follow-tags
# Ship it πŸš€
npm publish

License

MIT

Support

Buy Me A Coffee

FAQs

Package last updated on 15 May 2019

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