项目作者: CDDelta

项目描述 :
Web Monetization API for Angular!
高级语言: TypeScript
项目地址: git://github.com/CDDelta/ngx-monetization.git
创建时间: 2020-05-15T08:42:21Z
项目社区:https://github.com/CDDelta/ngx-monetization

开源协议:MIT License

下载


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:

  1. ng add ngx-monetization

or install it via npm:

  1. npm install ngx-monetization --save

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

Example Use

  1. import { Component } from "@angular/core";
  2. import { MonetizationService } from "ngx-monetization";
  3. @Component({
  4. selector: "app-root",
  5. template: `
  6. <p>State: {{ monetization.state | async }}</p>
  7. <ul>
  8. <li *ngFor="let event of monetization.events | async">
  9. {{ event | json }}
  10. </li>
  11. </ul>
  12. `,
  13. })
  14. export class AppComponent {
  15. constructor(public monetization: MonetizationService) {
  16. monetization.setPaymentPointer("$wallet.example.com/alice");
  17. }
  18. }

Contributing

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

To build the library run:

  1. npm run build

To run tests run:

  1. npm run test

To test the demo app run:

  1. npm run start