npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

my-test-intersection-observer

v0.0.12

Published

IntersectionObserver for hippy-vue

Downloads

3

Readme

hippy-vue-intersection-observer

hippy-vue-intersection-observer is a Hippy-Vue implementation of Intersection Observer.

It provides an easier way to detect view exposure in complex application.

Note: This component is inspired by and adapted from 'rn-intersection-observer'

Install

# Install using Yarn:
yarn add hippy-vue-intersection-observer

# or NPM:
npm install -S hippy-vue-intersection-observer

Usage

Target view

<hippy-vue-observer
  scope="YourOwnScope"
  :thresholds="[0.2, 0.5]"
  @on-change="onIntersectionChange"
>
{/* your own view */}
</hippy-vue-observer>


<script>

import { HippyVueObserver, HippyIntersectionEmitEvent } from "hippy-vue-intersection-observer";

// register hippy-vue-observer before use
Vue.use(HippyVueObserver);

// ...

export default {
  // ...
  methods: {
    onIntersectionChange(entry) {
      console.log(entry);
    },
  },
  
}

</script>

Trigger detection from Vue

methods: {
    onScroll(e) {
      HippyIntersectionEmitEvent("myScope");
    },
}

Trigger detection from Native

HippyMap hippyMap = new HippyMap();
hippyMap.pushString("scope", "YourOwnScope");
mEngineManager.getCurrentEngineContext()
    .getModuleManager()
    .getJavaScriptModule(EventDispatcher.class)
    .receiveNativeEvent("IntersectionObserverEvent", hippyMap);
// 可参考HippyEventObserverModule.m
[self sendEvent:@"IntersectionObserverEvent" params:@{ @"scope": @"YourOwnScope" }];
- (void)sendEvent:(NSString *)eventName params:(NSDictionary *)params {
    HippyAssertParam(eventName);
    [self.bridge.eventDispatcher dispatchEvent:@"EventDispatcher" 
                                    methodName:@"receiveNativeEvent" 
                                          args:@{@"eventName": eventName, @"extra": params ? : @{}}];
}

Props & Params

1) IntersectionObserver / hippy-vue-observer

| Props | Params Type | Description | |:-----------------------------------------------------------------------------------------------|:-----------------------------------------------------------|:-----------------------------------------------------------------| | scope | string | Scope of the target View, required in event trigger. | | rootMargin | {top: number, left: number, bottom: number, right: number} | Distance from screen edge of detect area. | | thresholds | number[] | Intersection ratios which should trigger intersection callbacks. | | throttle | number | Throttle time between each detection(ms). |

2) Intersection Callback (on-change)

Different from IntersectionObserver, hippy-vue-observer provides single parameter.

| Params | Params Type | Description | |:-----------------------------------------------------------------------------------------------------|:-----------------------------------------------------------|:-------------------------------------------------------------------| | boundingClientRect | {top: number, left: number, bottom: number, right: number} | Position of target View's edge. | | intersectionRatio | number | Intersection ratio of target View in detect area | | intersectionRect | {top: number, left: number, bottom: number, right: number} | Position of intersection area's edge. | | target | Ref | Ref of target View | | isIntersecting | boolean | Determine current intersection ratio is larger than any threshold. |

License

ISC