New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

web-plugin-interface

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

web-plugin-interface - npm Package Compare versions

Comparing version
2.0.2
to
3.0.0
+15
-4
index.js

@@ -6,2 +6,3 @@ 'use strict';

* @author OlegDutchenko <dutchenko.o.dev@gmail.com>
* @version 3.0.0
*/

@@ -18,2 +19,16 @@

/**
* @type {Object}
*/
get defaultSettings () {
return {};
}
/**
* @type {Object}
*/
get defaultProps () {
return {};
}
/**
* @protected

@@ -42,6 +57,2 @@ */

}
get defaults () {
return {};
}
}
{
"name": "web-plugin-interface",
"version": "2.0.2",
"version": "3.0.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

+86
-23

@@ -23,2 +23,5 @@ # web-plugin-interface

- [`constructor()`](#constructor)
- [_~~defaults~~_](#defaults)
- [`defaultSettings`](#defaultsettings)
- [`defaultProps`](#defaultprops)
- [`_setup()`](#_setup)

@@ -28,3 +31,2 @@ - [`_beforeInitialize()`](#_beforeinitialize)

- [`initialize()`](#initialize)
- [`defaults`](#defaults)

@@ -38,3 +40,22 @@

### `defaults`
> since v3.0.0 property renamed to `defaultSettings`
### `defaultSettings`
_`public`_
_**`since v3.0.0`**_
A getter that returns an object with default options, settings, or configuration for your plugin.
### `defaultProps`
_`public`_
_**`since v3.0.0`**_
A getter that returns an object with predefined props.
Most often this is a list of options that are not included in the list of certain options of your plugin. But you need them for individual processing your options, settings, data, etc.
### `_setup()`

@@ -67,8 +88,2 @@

### `defaults`
_`public`_
A getter that returns an object with default options, settings, or configuration for your plugin.
---

@@ -94,4 +109,5 @@

* @param {Object} [customSettings={}]
* @param {Object} [customProps={}]
*/
constructor ($container, customSettings = {}) {
constructor ($container, customSettings = {}, customProps = {}) {
super();

@@ -101,12 +117,44 @@ this.$container = $container;

this.settings = {};
this.props = {};
this.readyCssClass = 'is-ready';
this.initializedCssClass = 'is-initialized';
}
/**
* @type {Object}
*/
get defaultSettings () {
return {
// an example of some options of your plugin
autoplay: true,
speed: 500
}
}
/** @protected */
/**
* @type {Object}
*/
get defaultProps () {
return {
// an example of options that is native for your plugin
stopAutoPlayIfOutView: true
}
}
/**
* @protected
*/
_setup () {
this.settings = $.extends({}, this.defaults, this.customSettings);
this.props = $.extends({}, this.defaultProps, this.customProps);
this.settings = $.extends({}, this.defaultSettings, this.customSettings);
// props example
if (this.props.stopAutoPlayIfOutView) {
this.settings.autoplay = this.detectIfInView;
}
}
/** @protected */
/**
* @protected
*/
_beforeInitialize () {

@@ -116,27 +164,42 @@ this.$container.addClass(this.readyCssClass);

/** @protected */
/**
* @protected
*/
_afterInitialize () {
this.$container.addClass(this.initializedCssClass);
// props example
if (this.props.stopAutoPlayIfOutView) {
this._autoplayInViewObserve();
}
}
/** @public */
initialize () {
this._setup();
this._beforeInitialize();
this._setup();
this._beforeInitialize();
// fire up
this.$container.someJqueryPlugin(this.settings);
this._afterInitialize();
}
// ------------------------------
// Custom extend implemented interface
// ------------------------------
/**
* @public
* @returns Object
* @type {boolean}
*/
get detectIfInView () {
// your code
}
/**
* @protected
*/
get defaults () {
return {
// an example of some options of your plugin
autoplay: false,
speed: 500
}
_autoplayInViewObserve () {
// your code
}
}
```