Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rater-js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rater-js

Star rating widget for the browser.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-39.67%
Maintainers
1
Weekly downloads
 
Created
Source

rater

Star rating widget for the browser.

Install

npm install rater-js --save

Usage

rater-js can be used with amd, commonjs or without any module loader using rater from global scope.

In your html create a new element that acts as the placeholder for the widget.

<!--Add the styling to the head-->
<link href="node-modules/rater-js/rater-js.css" rel="stylesheet"> 

<div id="rater"></div>

<!--Add js before end body tag-->
<script src="node-modules/rater-js/index.js"></script>

Node/Browserfiy


var rater = require("rater-js");

 var myRater = rater({element: document.querySelector("#rater"), rateCallback: function rateCallback(rating) {
                //make async call to server
                myRater.setRating(rating);
                //we could disable the rater after rating to prevent another rating
                myRater.disable();
	}});

See Example for more information.

Configuration

{
        element: HtmlElement,
        rateCallback: Function,
        max: "Number of stars",
        disableText: "Text",
        ratingText: "Text {rating}",
        readOnly: true/false
}

Methods

disable: Disable the widget
enable: Enable the widget
setRating(rating:number): Set the rating

Keywords

FAQs

Package last updated on 07 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc