CDDelta / ngx-monetization

Web Monetization API for Angular!

Home Page:https://cddelta.github.io/ngx-monetization/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ngx-monetization

contributions welcome

https://nodei.co/npm/ngx-monetization.png?downloads=true&downloadRank=true&stars=true

Web Monetization API for Angular!

ngx-monetization helps you interact with the Web Monetization API with an observable-based API.

The Web Monetization API is a JavaScript browser API which allows the creation of a payment stream from the user agent to the website, read more about it here.

Check out the demo here.

Install

To use ngx-monetization in your project run:

ng add ngx-monetization

or install it via npm:

npm install ngx-monetization --save

and add your payment pointer to index.html, see here.

Example Use

import { Component } from "@angular/core";
import { MonetizationService } from "ngx-monetization";

@Component({
  selector: "app-root",
  template: `
    <p>State: {{ monetization.state | async }}</p>
    <ul>
      <li *ngFor="let event of monetization.events | async">
        {{ event | json }}
      </li>
    </ul>
  `,
})
export class AppComponent {
  constructor(public monetization: MonetizationService) {
    monetization.setPaymentPointer("$wallet.example.com/alice");
  }
}

Contributing

To contribute to this library, clone it locally and run npm install.

To build the library run:

npm run build

To run tests run:

npm run test

To test the demo app run:

npm run start

About

Web Monetization API for Angular!

https://cddelta.github.io/ngx-monetization/

License:MIT License


Languages

Language:TypeScript 49.6%Language:HTML 25.8%Language:CSS 14.5%Language:JavaScript 10.0%