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

@goldfishjs/plugins

Package Overview
Dependencies
Maintainers
2
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goldfishjs/plugins - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

105

lib/BridgePlugin.js

@@ -8,2 +8,35 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

import _inherits from "@babel/runtime/helpers/inherits";
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import Plugin from './Plugin';

@@ -32,14 +65,18 @@

value: function call(api, params) {
return _regeneratorRuntime.async(function call$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", _bridge.call(api, params));
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", _bridge.call(api, params));
case 1:
case "end":
return _context.stop();
case 1:
case "end":
return _context.stop();
}
}
}
});
}, _callee);
}));
} // my.call('xxx')

@@ -50,14 +87,18 @@

value: function mycall(api, params) {
return _regeneratorRuntime.async(function mycall$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", _bridge.mycall(api, params));
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee2() {
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", _bridge.mycall(api, params));
case 1:
case "end":
return _context2.stop();
case 1:
case "end":
return _context2.stop();
}
}
}
});
}, _callee2);
}));
} // my.ap.xxx

@@ -68,14 +109,18 @@

value: function ap(api, params) {
return _regeneratorRuntime.async(function ap$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", _bridge.ap(api, params));
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee3() {
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", _bridge.ap(api, params));
case 1:
case "end":
return _context3.stop();
case 1:
case "end":
return _context3.stop();
}
}
}
});
}, _callee3);
}));
}

@@ -82,0 +127,0 @@ }]);

import _observable from "@goldfishjs/reactive-connect/lib/decorators/observable";
import _state from "@goldfishjs/reactive-connect/lib/decorators/state";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";

@@ -11,6 +10,2 @@ import _createClass from "@babel/runtime/helpers/createClass";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var __decorate = this && this.__decorate || function (decorators, target, key, desc) {

@@ -49,3 +44,3 @@ var c = arguments.length,

value: function addToast(option) {
this.feedbackQueue.push(_objectSpread({}, option, {
this.feedbackQueue.push(Object.assign(Object.assign({}, option), {
popType: 'toast',

@@ -59,3 +54,3 @@ isBlock: 'isBlock' in option ? option.isBlock : false,

value: function addAlert(option) {
this.feedbackQueue.push(_objectSpread({}, option, {
this.feedbackQueue.push(Object.assign(Object.assign({}, option), {
popType: 'alert',

@@ -68,3 +63,3 @@ isBlock: 'isBlock' in option ? option.isBlock : true

value: function addConfirm(option) {
this.feedbackQueue.push(_objectSpread({}, option, {
this.feedbackQueue.push(Object.assign(Object.assign({}, option), {
popType: 'confirm',

@@ -77,3 +72,3 @@ isBlock: 'isBlock' in option ? option.isBlock : true

value: function addPrompt(option) {
this.feedbackQueue.push(_objectSpread({}, option, {
this.feedbackQueue.push(Object.assign(Object.assign({}, option), {
popType: 'prompt',

@@ -80,0 +75,0 @@ isBlock: 'isBlock' in option ? option.isBlock : true

@@ -9,2 +9,35 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

import _inherits from "@babel/runtime/helpers/inherits";
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import ConfigPlugin from './ConfigPlugin';

@@ -37,14 +70,28 @@ import BridgePlugin from './BridgePlugin';

value: function call(api, params) {
return _regeneratorRuntime.async(function call$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", this.host ? _mockBridge.call(this.host, api, params) : _get(_getPrototypeOf(MockBridgePlugin.prototype), "call", this).call(this, api, params));
var _this = this;
case 1:
case "end":
return _context.stop();
var _super = Object.create(null, {
call: {
get: function get() {
return _get(_getPrototypeOf(MockBridgePlugin.prototype), "call", _this);
}
}
}, null, this);
});
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", this.host ? _mockBridge.call(this.host, api, params) : _super.call.call(this, api, params));
case 1:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
} // my.call('xxx')

@@ -55,14 +102,28 @@

value: function mycall(api, params) {
return _regeneratorRuntime.async(function mycall$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", this.host ? _mockBridge.mycall(this.host, api, params) : _get(_getPrototypeOf(MockBridgePlugin.prototype), "mycall", this).call(this, api, params));
var _this2 = this;
case 1:
case "end":
return _context2.stop();
var _super = Object.create(null, {
mycall: {
get: function get() {
return _get(_getPrototypeOf(MockBridgePlugin.prototype), "mycall", _this2);
}
}
}, null, this);
});
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee2() {
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.abrupt("return", this.host ? _mockBridge.mycall(this.host, api, params) : _super.mycall.call(this, api, params));
case 1:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
} // my.ap.xxx

@@ -73,14 +134,28 @@

value: function ap(api, params) {
return _regeneratorRuntime.async(function ap$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", this.host ? _mockBridge.ap(this.host, api, params) : _get(_getPrototypeOf(MockBridgePlugin.prototype), "ap", this).call(this, api, params));
var _this3 = this;
case 1:
case "end":
return _context3.stop();
var _super = Object.create(null, {
ap: {
get: function get() {
return _get(_getPrototypeOf(MockBridgePlugin.prototype), "ap", _this3);
}
}
}, null, this);
});
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee3() {
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.abrupt("return", this.host ? _mockBridge.ap(this.host, api, params) : _super.ap.call(this, api, params));
case 1:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
}

@@ -87,0 +162,0 @@ }]);

@@ -19,2 +19,34 @@ import _observable from "@goldfishjs/reactive-connect/lib/decorators/observable";

var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function (resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var PluginHub =

@@ -38,53 +70,57 @@ /*#__PURE__*/

value: function register(pluginClass) {
var _this = this;
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
var _this = this;
var plugin;
return _regeneratorRuntime.async(function register$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (pluginClass.type) {
_context.next = 2;
break;
}
var plugin;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (pluginClass.type) {
_context.next = 2;
break;
}
throw new Error("Please set the static type property for PluginClass: ".concat(pluginClass));
throw new Error("Please set the static type property for PluginClass: ".concat(pluginClass));
case 2:
plugin = new pluginClass();
this.plugins[pluginClass.type] = plugin;
case 2:
plugin = new pluginClass();
this.plugins[pluginClass.type] = plugin;
if (!(this.state === 'init_start')) {
_context.next = 6;
break;
}
if (!(this.state === 'init_start')) {
_context.next = 6;
break;
}
return _context.abrupt("return", new Promise(function (resolve, reject) {
var stop = _watch(function () {
return _this.state;
}, function (newVal) {
if (newVal === 'ready') {
try {
plugin.init(_this.get.bind(_this));
resolve();
} catch (e) {
reject(e);
return _context.abrupt("return", new Promise(function (resolve, reject) {
var stop = _watch(function () {
return _this.state;
}, function (newVal) {
if (newVal === 'ready') {
try {
plugin.init(_this.get.bind(_this));
resolve();
} catch (e) {
reject(e);
}
stop();
}
});
}));
stop();
}
});
}));
case 6:
if (this.state === 'ready') {
plugin.init(this.get.bind(this));
}
case 6:
if (this.state === 'ready') {
plugin.init(this.get.bind(this));
}
case 7:
case "end":
return _context.stop();
case 7:
case "end":
return _context.stop();
}
}
}
}, null, this);
}, _callee, this);
}));
}

@@ -117,22 +153,26 @@ }, {

value: function init() {
var type, plugin;
return _regeneratorRuntime.async(function init$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
this.state = 'init_start';
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee2() {
var type, plugin;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
this.state = 'init_start';
for (type in this.plugins) {
plugin = this.plugins[type];
plugin.init(this.get.bind(this));
}
for (type in this.plugins) {
plugin = this.plugins[type];
plugin.init(this.get.bind(this));
}
this.state = 'ready';
this.state = 'ready';
case 3:
case "end":
return _context2.stop();
case 3:
case "end":
return _context2.stop();
}
}
}
}, null, this);
}, _callee2, this);
}));
}

@@ -139,0 +179,0 @@ }, {

@@ -1,2 +0,1 @@

import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _regeneratorRuntime from "@babel/runtime/regenerator";

@@ -10,6 +9,34 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function (resolve) {
resolve(value);
});
}
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { route } from '@goldfishjs/route';

@@ -80,27 +107,31 @@ import Plugin from './Plugin';

value: function reLaunch(url) {
return _regeneratorRuntime.async(function reLaunch$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
_context.next = 3;
return _regeneratorRuntime.awrap(this.bridge.call('reLaunch', {
url: url
}));
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.prev = 0;
_context.next = 3;
return this.bridge.call('reLaunch', {
url: url
});
case 3:
_context.next = 8;
break;
case 3:
_context.next = 8;
break;
case 5:
_context.prev = 5;
_context.t0 = _context["catch"](0);
route.pushWindow(url);
case 5:
_context.prev = 5;
_context.t0 = _context["catch"](0);
route.pushWindow(url);
case 8:
case "end":
return _context.stop();
case 8:
case "end":
return _context.stop();
}
}
}
}, null, this, [[0, 5]]);
}, _callee, this, [[0, 5]]);
}));
}

@@ -123,15 +154,19 @@ }, {

value: function switchTab(options) {
return _regeneratorRuntime.async(function switchTab$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _regeneratorRuntime.awrap(this.bridge.call('switchTab', _objectSpread({}, options)));
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee2() {
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return this.bridge.call('switchTab', Object.assign({}, options));
case 2:
case "end":
return _context2.stop();
case 2:
case "end":
return _context2.stop();
}
}
}
}, null, this);
}, _callee2, this);
}));
}

@@ -138,0 +173,0 @@ }, {

{
"name": "@goldfishjs/plugins",
"version": "0.0.2",
"version": "0.0.3",
"description": "goldfish-plugins",

@@ -19,8 +19,8 @@ "main": "lib/index.js",

"dependencies": {
"@goldfishjs/bridge": "^0.0.2",
"@goldfishjs/reactive": "^0.0.2",
"@goldfishjs/reactive-connect": "^0.0.2",
"@goldfishjs/requester": "^0.0.2",
"@goldfishjs/route": "^0.0.2",
"@goldfishjs/utils": "^0.0.2",
"@goldfishjs/bridge": "^0.0.3",
"@goldfishjs/reactive": "^0.0.3",
"@goldfishjs/reactive-connect": "^0.0.3",
"@goldfishjs/requester": "^0.0.3",
"@goldfishjs/route": "^0.0.3",
"@goldfishjs/utils": "^0.0.3",
"mini-types": "^0.0.4"

@@ -27,0 +27,0 @@ },

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