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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pebble-peek-test

v1.0.1

Published

A way to test Timeline Peek events in CloudPebble.

Readme

pebble-peek-test

A way to test Timeline Peek events in CloudPebble.

As I'm writing this there is no way to test Timeline Peek events in CloudPebble, so I wrote an emulator using the same callback handlers to emulate the behaviour of unobstructed area change events.

The resulting animation it not exactly the same as with real events but it is a pretty good approximation.

To use the peek test you have to add the Layer returned by peek_test_init to your root layer. This will be the layer that shows the peek. The peek will appear/disappear at the specified interval.

Instead of layer_get_unobstructed_bounds you have to use peek_test_get_unobstructed_bounds. The subscribe and unsubscribe functions just have an added peek_test_ in front.

You can use the PEEKL_TEST define to determine whether or not the peek test is used. The define is set if pebble-peek-test.h is included. When used correctly you can easily switch between emulation and real events by just commenting out the pebble-peek-test.h include.

Here are some images of what the peeks look like (more: http://imgur.com/a/yZ75V): BCD minimalist

The one in the middle shows real Timeline Peek events, the others are emulated.

Usage example:

#include <pebble-peek-test/pebble-peek-test.h>

GSize available_screen;

static void update_layers() {
  /* do something based on available_screen */
}
  
static void unobstructed_area_will_change(GRect final_unobstructed_screen_area, void *context) {
  APP_LOG(APP_LOG_LEVEL_INFO, "will change = %d/%d", final_unobstructed_screen_area.size.w, final_unobstructed_screen_area.size.h);
}
  
static void unobstructed_area_change(AnimationProgress progress, void* context) {
  APP_LOG(APP_LOG_LEVEL_INFO, "change = %ld%%", (progress*100)/ANIMATION_NORMALIZED_MAX);
#ifdef PEEK_TEST
  GRect unobstructed_area = peek_test_get_unobstructed_bounds();
#else // PEEK_TEST
  GRect unobstructed_area = layer_get_unobstructed_bounds(window_get_root_layer(my_window));
#endif // PEEK_TEST
  available_screen = unobstructed_area.size;
  update_layers();
}
  
static void unobstructed_area_did_change(void* context) {
  APP_LOG(APP_LOG_LEVEL_INFO, "did_change");
}

static void my_window_load(Window *window) {
  Layer* root_layer = window_get_root_layer(window);
  GRect root_layer_bounds = layer_get_bounds(root_layer);
  available_screen = layer_get_unobstructed_bounds(root_layer).size;
  
  UnobstructedAreaHandlers handlers = {
    .will_change = unobstructed_area_will_change,
    .change = unobstructed_area_change,
    .did_change = unobstructed_area_did_change
  };
#ifdef PEEK_TEST
  static Layer* peek_layer;
  peek_layer = peek_test_init(root_layer_bounds, 5000);
  layer_add_child(root_layer, peek_layer);
  peek_test_unobstructed_area_service_subscribe(handlers, NULL);
#else // PEEK_TEST
  unobstructed_area_service_subscribe(handlers, NULL);
#endif // PEEK_TEST
  
  update_layers();
}
  
static void my_window_unload(Window *window) {
#ifdef PEEK_TEST
  peek_test_unobstructed_area_service_unsubscribe();
#else // PEEK_TEST
  unobstructed_area_service_unsubscribe();
#endif // PEEK_TEST
}