JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 52
  • Score
    100M100P100Q57511F
  • License MIT

A lightweight visit & like count javascript plugin.

Package Exports

  • vilike

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vilike) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ViLikeJS

👀👍 A lightweight visit & like count javascript plugin.

Build GitHub package.json version (branch) Version

国内文档请直接访问 : https://vilike.seeyoz.cn

Ready

1.You need to go to Bmob to register an account and create an APP, then find "云数据库" on the right.
2.Click on "云数据库" and then find "添加表" in the upper left corner to create a data table.
3.Create fields according to the following table:

objectId skey visit like createdAt updatedAt ACL

NOTE: You need to set skey as the unique key.

Installation

Add Bmob.js and ViLike.js to your project.

<script src='https://cdn.jsdelivr.net/gh/bmob/hydrogen-js-sdk@2.2.3/dist/Bmob-2.2.3.min.js'></script>
<script src='https://cdn.jsdelivr.net/gh/zpfz/ViLikeJS@0.1.0-beta/dist/ViLike-0.1.0-beta.min.js'></script>

ViLikeJS is available via npm.

npm install --save vilike

Initialization

You need to use the following API to configure:

ViLike.configure({
  secretKey: 'Your Secret Key',
  safeKey: 'Your Safe Key',
  table: 'Table Name',
  key: 'Key Prop Name(Not Value)',
  visit: 'Visit Prop Name',
  like: 'Like Prop Name'
});

PS:Please replace the relevant information. Then you also need to initialize it:

ViLike.init();

Well done! You can start using other APIs.

Usage

ViLike.get

Get the number of visits and likes and like status.

ViLike.get('1192a75ccf48e109',(visit,like,islike)=>{
  console.log(visit,like,islike)
});

ViLike.like

Count the like field and get the current number of likes.

ViLike.like('1192a75ccf48e109',(like)=>{
  console.log(like)
})

See here for more details : https://vilike.seeyoz.cn