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

glamar-sdk

v1.0.0

Published

GlamAR Web SDK provides a set of APIs that enable real time virtual makeup try-on on a web page.

Downloads

3

Readme

GlamAR Web SDK

GlamAR Web SDK provides a set of APIs that enable real time virtual makeup try-on on a web page.

Installation

Via script tags:

<script src="https://unpkg.com/[email protected]/dist/glamar-sdk.umd.js"></script>

Via npm:

Using npm:

npm install glamar-sdk

Using yarn:

yarn install glamar-sdk

Usage

If you are using via npm, first add:

import * as GlamAR from "glamar-sdk";

Then:

// Pass in the id of a container and your API key
GlamAR.init("GlamAR-module", <<YOUR_API_KEY>>);
GlamAR.addEventListener('opened', () =>
  GlamAR.applyMakeupBySku(<<SKU_ID>>)
);

also call applyMakeupBySku on any event to apply the makeup

<button onclick="GlamAR.applyMakeupBySku(<<SKU_ID>>)">Apply Lip Color</button>

API Reference

Methods

| Methods | Description | | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | GlamAR.init | GlamAR.init(containerId, apiKey, openLiveMakeup) | | | Parameters: containerId: string, id of the div to mount the widget apiKey: string, api key openLiveMakeup: boolean, whether to open widget in live mode. | | | Return Value: None | | | Initializes the widget | | GlamAR.applyMakeupBySku | GlamAR.applyMakeupBySku(skuId, callback) | | | Parameters: skuId: number, a sku IDcallback(optional): function, fires after the makeup effect is applied | | | Return Value: None | | | Changes the makeup effect by the given sku ID, you could retrieve your sku information from admin panel. | | GlamAR.addEventListener | GlamAR.addEventListener(eventName, handlerFunction) | | | Parameters: eventName: string, a named eventhandlerFunction: function, a handler | | | Return Value: None | | | Adds the listener to the given event name. | | GlamAR.removeEventListener | GlamAR.removeEventListener(eventName, handlerFunction) | | | Parameters:eventName: string, a named eventhandlerFunction: function, a handler | | | Return Value: None | | | Removes the given listener for the event name. | | GlamAR.getAllSKUs | GlamAR.getAllSKUs() | | | Parameters: None | | | Return Value: Promise that resolves to an array of SKUs available for the given API key. | | | Returns an array of available SKUs for the given API key. | | GlamAR.reset | GlamAR.reset() | | | Parameters: None | | | Return Value: None | | | Removes all the makeup effects from the canvas. | | GlamAR.close | GlamAR.close() | | | Parameters: None | | | Return Value: None | | | Closes canvas and back to main widget page. | | GlamAR.snapshot | GlamAR.snapshot(contentType, callback) | | | Parameters:contentType: string, valid value: base64 or blob | | | Return Value: image in base64 or blob | | | Takes a snapshot of current result window. | | GlamAR.isLoaded | GlamAR.isLoaded() | | | Parameters: None | | | Return Value: true if the module is loaded else false | | | Returns status of module loading. | | GlamAR.isLoading | GlamAR.isLoading() | | | Parameters: None | | | Return Value: true if the module is loading else false | | | Returns status of module loading. |

Events

| Events | Description | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | loaded | Payload: NoneThis event is fired when GlamAR module is loaded | | opened | Payload: NoneThis event is fired when the GlamAR module is opened. | | closed | Payload: NoneThis event is fired when the canvas is closed and user returns to main widget page. | | camera-opened | Payload: NoneThis event is fired when the camera is opened. | | camera-closed | Payload: NoneThis event is fired when the camera is closed. | | camera-failed | Payload: NoneThis event is fired when the camera failed. Either user refuses to grant permission or the app is unable to retrieve video stream normally. | | photo-loaded | Payload: NoneThis event is fired when a given photo loaded on the canvas. | | sku-applied | Payload: NoneThis event is fired when a given sku effects are applied. | | sku-failed | Payload: NoneThis event is fired when a given sku is not applied successfully. | | reset | Payload: NoneThis event is fired when all the effects are reset. | | error | Payload: ErrorThis event is fired anytime an error occurs. |

Sample WebAR SDK app

See the Glamar SDK quickstart sample on Gitlab for an example of this SDK in use.