🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

js-plugin

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-plugin - npm Package Compare versions

Comparing version
1.0.8
to
1.0.9
+1
-1
package.json
{
"name": "js-plugin",
"version": "1.0.8",
"version": "1.0.9",
"repository": "rekit/js-plugin",

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

@@ -5,2 +5,14 @@ var _plugins = [];

// Only support debug mode on browser and node, not web workers.
var isBrowser =
typeof window !== "undefined" && typeof window.document !== "undefined";
var isNode =
typeof process !== "undefined" &&
process.versions != null &&
process.versions.node != null;
var isDebug = (isBrowser && document.location.search.includes('JS_PLUGIN_DEBUG'))
|| (isNode && process.env && process.env.JS_PLUGIN_DEBUG);
function _isFunc(o) {

@@ -110,2 +122,3 @@ return !!(o.constructor && o.call && o.apply);

var obj = arr.join('.');
return this.getPlugins(prop).map(function(p) {

@@ -115,2 +128,3 @@ var method = _get(p, prop);

try {
isDebug && console.log('Before', p.name, prop, args);
return method.apply(_get(p, obj), args);

@@ -122,2 +136,4 @@ } catch (err) {

else console.log(err);
} finally {
isDebug && console.log('After ', p.name, prop, args);
}

@@ -124,0 +140,0 @@ return null;

@@ -7,2 +7,4 @@ # Overview

[<img src="https://opencollective.com/rekit/tiers/backers.svg?avatarHeight=60"/>](https://opencollective.com/rekit)
# Motivation

@@ -9,0 +11,0 @@ Web applications are becoming more and more complicated nowadays. To separate concerns, decouple business logic, a large application should be well designed. One of best practices is plugin based architecture. Whenever you add a new feature, it should not add much complication to the system so that the project could be always maintainable when it grows.