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

hpub2

v1.0.24

Published

> API Documentation for MagLoft Mobile Apps HPUB2 JavaScript Context

Downloads

6

Readme

MagLoft HPUB2 SDK

API Documentation for MagLoft Mobile Apps HPUB2 JavaScript Context

Installation

  • Download hpub2.js or install via npm install hpub2
  • Insert the script before the closing </body> tag

Usage

  • The MagLoft Native App will automatically initialize the SDK on load.
  • The HPUB2 API is exposed on window.MagloftApi
  • The current device / user context can be accessed at window.MagloftApi.context
  • API Methods are documented here

Examples

Open a URL in the device browser

MagloftApi.openUrl({ url: 'https://www.magloft.com/', target: '_blank' })

Track an Event using Firebase Analytics

MagloftApi.trackEvent({ name: 'purchase', parameters: { sku: 'ML123', price: 99 } })

Open the top navigation bar

MagloftApi.toggleNavigator({ active: true })

Share a URL using the native share dialog

MagloftApi.shareUrl({ url: 'https://www.magloft.com/' })

Share the current HPUB issue using the native share dialog

MagloftApi.shareIssue()

Close the current HPUB issue and return to the shelf

MagloftApi.close()

Trigger the native login flow

This will trigger the native Login Dialog. Will return the logged in reader (if successful), or undefined (if failed)

MagloftApi.login().then((reader) => {
  alert(reader.email)
})

Request Push Permissions

This will trigger the native Push Notification screen, prompting users to either allow or block notifications. Will return the new pushToken (if allowed), or undefined (if blocked)

MagloftApi.requestPushPermissions().then((pushToken) => {
  alert(pushToken)
})

Schedule Push Notifications

Schedule up to 1000 messages for the current user. The user needs to be logged in and must have accepted push notification permissions.

MagloftApi.schedulePushMessages([{
  title: 'Message 1',
  body: 'Message Body'
  deliveryDate: 1663910000, // UNIX Timestamp
  data: { key: 'value' } // Any Record<string, string>
}, {
  title: 'Message 2',
  body: 'Message Body'
  deliveryDate: 1663910000, // UNIX Timestamp
  data: { key: 'value' } // Any Record<string, string>
}]).then((scheduledCount) => {
  alert(`Scheduled ${scheduledCount} messages`)
})

Clear Push Notifications

Clear all scheduled push messages for the current user. The user needs to be logged in and must have accepted push notification permissions.

MagloftApi.clearPushMessages().then(() => {
  alert(`Cleared all push messages`)
})