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

@goldfishjs/reactive-connect

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/reactive-connect - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

7

lib/decorators/computed.js
import _defineProperty from "@babel/runtime/helpers/defineProperty";
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; }
import COMPUTED_KEY from './COMPUTED_KEY';

@@ -15,4 +10,4 @@ export default function computed(target, key, descriptor) {

target[COMPUTED_KEY] = _objectSpread({}, target[COMPUTED_KEY]);
target[COMPUTED_KEY] = Object.assign({}, target[COMPUTED_KEY]);
target[COMPUTED_KEY][key] = descriptor;
}

10

lib/decorators/observable.js

@@ -5,3 +5,2 @@ import _markObservable from "@goldfishjs/reactive/lib/markObservable";

import _typeof from "@babel/runtime/helpers/typeof";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";

@@ -12,7 +11,2 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";

import _inherits from "@babel/runtime/helpers/inherits";
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; }
import STATE_KEY from './STATE_KEY';

@@ -42,4 +36,4 @@ import COMPUTED_KEY from './COMPUTED_KEY';

var ownKeys = Object.getOwnPropertyNames(_assertThisInitialized(_this));
_this[STATE_KEY] = _objectSpread({}, _this[STATE_KEY]);
_this[COMPUTED_KEY] = _objectSpread({}, _this[COMPUTED_KEY]); // 将标记好的响应式属性融合到统一的地方。
_this[STATE_KEY] = Object.assign({}, _this[STATE_KEY]);
_this[COMPUTED_KEY] = Object.assign({}, _this[COMPUTED_KEY]); // 将标记好的响应式属性融合到统一的地方。

@@ -46,0 +40,0 @@ ownKeys.forEach(function (key) {

import _defineProperty from "@babel/runtime/helpers/defineProperty";
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; }
import STATE_KEY from './STATE_KEY';

@@ -19,4 +14,4 @@ var ORIGIN_STATE_FLAG = {};

target[STATE_KEY] = _objectSpread({}, target[STATE_KEY]);
target[STATE_KEY] = Object.assign({}, target[STATE_KEY]);
target[STATE_KEY][key] = ORIGIN_STATE_FLAG;
}

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

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 MiniDataSetter =

@@ -52,61 +84,65 @@ /*#__PURE__*/

value: function set(keyPathList, newV, oldV, options) {
var _this = this;
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
var _this = this;
return _regeneratorRuntime.async(function set$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.updateList.push(function () {
try {
var keyPathString = _generateKeyPathString(keyPathList);
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
this.updateList.push(function () {
try {
var keyPathString = _generateKeyPathString(keyPathList);
if (Array.isArray(newV) && Array.isArray(oldV) && options && options.method) {
var methodName = options && options.method;
var args = options && options.args;
var optionsOldV = options && options.oldV;
if (Array.isArray(newV) && Array.isArray(oldV) && options && options.method) {
var methodName = options && options.method;
var args = options && options.args;
var optionsOldV = options && options.oldV;
_this.setByKeyPathList(_this.view.data, keyPathList, options.oldV);
_this.setByKeyPathList(_this.view.data, keyPathList, options.oldV);
var map = {
push: [optionsOldV.length, 0].concat(_toConsumableArray(args)),
splice: args,
unshift: [0, 0].concat(_toConsumableArray(args)),
pop: [optionsOldV.length - 1, 1],
shift: [0, 1]
};
var spliceDataArgs = map[methodName];
var map = {
push: [optionsOldV.length, 0].concat(_toConsumableArray(args)),
splice: args,
unshift: [0, 0].concat(_toConsumableArray(args)),
pop: [optionsOldV.length - 1, 1],
shift: [0, 1]
};
var spliceDataArgs = map[methodName];
if (spliceDataArgs) {
_this.view.$spliceData(_defineProperty({}, keyPathString, spliceDataArgs));
if (spliceDataArgs) {
_this.view.$spliceData(_defineProperty({}, keyPathString, spliceDataArgs));
} else {
_this.view.setData(_defineProperty({}, keyPathString, newV));
}
} else {
_this.view.setData(_defineProperty({}, keyPathString, newV));
}
} else {
_this.view.setData(_defineProperty({}, keyPathString, newV));
} catch (e) {
_this.view.setData(_defineProperty({}, keyPathList[0], _this.view.data[keyPathList[0]]));
console.warn(e);
}
} catch (e) {
_this.view.setData(_defineProperty({}, keyPathList[0], _this.view.data[keyPathList[0]]));
});
_context.next = 3;
return Promise.resolve();
console.warn(e);
}
});
_context.next = 3;
return _regeneratorRuntime.awrap(Promise.resolve());
case 3:
// Component Store needs $page.$batchedUpdates
(this.view.$batchedUpdates ? this.view.$batchedUpdates.bind(this.view) : this.view.$page.$batchedUpdates.bind(this.view.$page))(function () {
_this.updateList.forEach(function (update) {
return update();
});
case 3:
// Component Store needs $page.$batchedUpdates
(this.view.$batchedUpdates ? this.view.$batchedUpdates.bind(this.view) : this.view.$page.$batchedUpdates.bind(this.view.$page))(function () {
_this.updateList.forEach(function (update) {
return update();
_this.updateList = [];
});
_this.updateList = [];
});
case 4:
case "end":
return _context.stop();
case 4:
case "end":
return _context.stop();
}
}
}
}, null, this);
}, _callee, this);
}));
}

@@ -113,0 +149,0 @@ }]);

@@ -18,2 +18,34 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

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 STATE_KEY from './decorators/STATE_KEY';

@@ -104,23 +136,27 @@ import COMPUTED_KEY from './decorators/COMPUTED_KEY';

(function _callee() {
return _regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this.isInitLoading = true;
_context.prev = 1;
_context.next = 4;
return _regeneratorRuntime.awrap(_this.fetchInitData());
(function () {
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:
this.isInitLoading = true;
_context.prev = 1;
_context.next = 4;
return this.fetchInitData();
case 4:
_context.prev = 4;
_this.isInitLoading = false;
return _context.finish(4);
case 4:
_context.prev = 4;
this.isInitLoading = false;
return _context.finish(4);
case 7:
case "end":
return _context.stop();
case 7:
case "end":
return _context.stop();
}
}
}
}, null, null, [[1,, 4, 7]]);
}, _callee, this, [[1,, 4, 7]]);
}));
})();

@@ -127,0 +163,0 @@ }

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

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

"dependencies": {
"@goldfishjs/reactive": "^0.0.2",
"@goldfishjs/reactive": "^0.0.3",
"mini-types": "^0.0.4"

@@ -22,0 +22,0 @@ },

@@ -13,4 +13,4 @@ {

"esModuleInterop": true,
"module": "esnext",
"target": "esnext",
"module": "es6",
"target": "es6",
"outDir": "../lib",

@@ -17,0 +17,0 @@ "declaration": true,

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