Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release-2.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Brüderlin committed Mar 22, 2018
2 parents e4804b4 + b66f49c commit 45a8479
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ particles.js is a lightweight, dependency-free and responsive javascript plugin
There are several ways to install particles.js:
- [Download the latest version](https://github.com/marcbruederlin/particles.js/archive/master.zip)
- Install with npm: `npm install particlesjs --save`
- Use the CDN: `https://cdnjs.cloudflare.com/ajax/libs/particlesjs/2.2.1/particles.min.js`
- Use the CDN: `https://cdnjs.cloudflare.com/ajax/libs/particlesjs/2.2.2/particles.min.js`

## Usage
Include the minified JS in your HTML (right before the closing body tag).
Expand Down Expand Up @@ -81,6 +81,7 @@ Method | Description
------ | -----------
`pauseAnimation` | Pauses/stops the particle animation
`resumeAnimation` | Continues the particle animation
`destroy` | Destroys the plugin

Example how to use the [public methods](https://marcbruederlin.github.io/particles.js/#use-methods).

Expand Down
23 changes: 20 additions & 3 deletions dist/particles.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A lightweight, dependency-free and responsive javascript plugin for particle backgrounds.
*
* @author Marc Bruederlin <hello@marcbruederlin.com>
* @version 2.2.1
* @version 2.2.2
* @license MIT
* @see https://github.com/marcbruederlin/particles.js
*/
Expand Down Expand Up @@ -63,7 +63,7 @@ var Particles = (function(window, document) {
}());

/**
* Initializes the plugin with user settings.
* Public mehtod to initialize the plugin with user settings.
*
* @public
* @param {object} settings
Expand All @@ -86,6 +86,22 @@ var Particles = (function(window, document) {
return _;
};

/**
* Public method to destroy the plugin.
*
* @public
*/
Plugin.prototype.destroy = function() {
var _ = this;

_.storage = [];
_.element.remove();

window.removeEventListener('resize', _.listener, false);
window.clearTimeout(_._animation);
cancelAnimationFrame(_._animation);
};

/**
* Setup the canvas element.
*
Expand Down Expand Up @@ -128,7 +144,8 @@ var Particles = (function(window, document) {
Plugin.prototype._initializeEvents = function() {
var _ = this;

window.addEventListener('resize', _._resize.bind(_), false);
_.listener = function() { _._resize(); }.bind(this);
window.addEventListener('resize', _.listener, false);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions dist/particles.min.js
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "particlesjs",
"version": "2.2.1",
"version": "2.2.2",
"description": "A lightweight, dependency-free and responsive javascript plugin for particle backgrounds.",
"main": "dist/particles.min.js",
"repository": {
Expand Down
23 changes: 20 additions & 3 deletions src/particles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A lightweight, dependency-free and responsive javascript plugin for particle backgrounds.
*
* @author Marc Bruederlin <hello@marcbruederlin.com>
* @version 2.2.1
* @version 2.2.2
* @license MIT
* @see https://github.com/marcbruederlin/particles.js
*/
Expand Down Expand Up @@ -63,7 +63,7 @@ var Particles = (function(window, document) {
}());

/**
* Initializes the plugin with user settings.
* Public mehtod to initialize the plugin with user settings.
*
* @public
* @param {object} settings
Expand All @@ -86,6 +86,22 @@ var Particles = (function(window, document) {
return _;
};

/**
* Public method to destroy the plugin.
*
* @public
*/
Plugin.prototype.destroy = function() {
var _ = this;

_.storage = [];
_.element.remove();

window.removeEventListener('resize', _.listener, false);
window.clearTimeout(_._animation);
cancelAnimationFrame(_._animation);
};

/**
* Setup the canvas element.
*
Expand Down Expand Up @@ -128,7 +144,8 @@ var Particles = (function(window, document) {
Plugin.prototype._initializeEvents = function() {
var _ = this;

window.addEventListener('resize', _._resize.bind(_), false);
_.listener = function() { _._resize(); }.bind(this);
window.addEventListener('resize', _.listener, false);
};

/**
Expand Down

0 comments on commit 45a8479

Please sign in to comment.