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

@goldfishjs/core

Package Overview
Dependencies
Maintainers
2
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goldfishjs/core - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

353

lib/store/AppStore.js

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

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

@@ -21,6 +20,34 @@ import _asyncForEach from "@goldfishjs/utils/lib/asyncForEach";

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());
});
};
/**

@@ -199,85 +226,95 @@ * State management for App.

return feedback.feedbackQueue;
}, function _callee2() {
var queue;
return _regeneratorRuntime.async(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!isFeedbackConsuming) {
_context2.next = 2;
break;
}
}, function () {
return __awaiter(_this5, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee2() {
var _this6 = this;
return _context2.abrupt("return");
var queue;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!isFeedbackConsuming) {
_context2.next = 2;
break;
}
case 2:
isFeedbackConsuming = true;
queue = _toConsumableArray(feedback.feedbackQueue);
_context2.next = 6;
return _regeneratorRuntime.awrap(_asyncForEach(queue, function _callee(item) {
return _regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!shouldStopIteration) {
_context.next = 2;
break;
}
return _context2.abrupt("return");
return _context.abrupt("return", true);
case 2:
isFeedbackConsuming = true;
queue = _toConsumableArray(feedback.feedbackQueue);
_context2.next = 6;
return _asyncForEach(queue, function (item) {
return __awaiter(_this6, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!shouldStopIteration) {
_context.next = 2;
break;
}
case 2:
_context.t0 = item.popType;
_context.next = _context.t0 === 'toast' ? 5 : _context.t0 === 'alert' ? 8 : _context.t0 === 'confirm' ? 11 : _context.t0 === 'prompt' ? 14 : 17;
break;
return _context.abrupt("return", true);
case 5:
_context.next = 7;
return _regeneratorRuntime.awrap(options.showToast && options.showToast(item));
case 2:
_context.t0 = item.popType;
_context.next = _context.t0 === 'toast' ? 5 : _context.t0 === 'alert' ? 8 : _context.t0 === 'confirm' ? 11 : _context.t0 === 'prompt' ? 14 : 17;
break;
case 7:
return _context.abrupt("break", 17);
case 5:
_context.next = 7;
return options.showToast && options.showToast(item);
case 8:
_context.next = 10;
return _regeneratorRuntime.awrap(options.alert && options.alert(item));
case 7:
return _context.abrupt("break", 17);
case 10:
return _context.abrupt("break", 17);
case 8:
_context.next = 10;
return options.alert && options.alert(item);
case 11:
_context.next = 13;
return _regeneratorRuntime.awrap(options.confirm && options.confirm(item));
case 10:
return _context.abrupt("break", 17);
case 13:
return _context.abrupt("break", 17);
case 11:
_context.next = 13;
return options.confirm && options.confirm(item);
case 14:
_context.next = 16;
return _regeneratorRuntime.awrap(options.prompt && options.prompt(item));
case 13:
return _context.abrupt("break", 17);
case 16:
return _context.abrupt("break", 17);
case 14:
_context.next = 16;
return options.prompt && options.prompt(item);
case 17:
case "end":
return _context.stop();
}
}
case 16:
return _context.abrupt("break", 17);
case 17:
case "end":
return _context.stop();
}
}
}, _callee);
}));
});
}));
case 6:
isFeedbackConsuming = false;
case 6:
isFeedbackConsuming = false;
if (feedback.feedbackQueue.length && queue.length) {
feedback.feedbackQueue.splice(0, queue.length);
}
if (feedback.feedbackQueue.length && queue.length) {
feedback.feedbackQueue.splice(0, queue.length);
}
case 8:
case "end":
return _context2.stop();
case 8:
case "end":
return _context2.stop();
}
}
}
});
}, _callee2);
}));
}, {

@@ -303,63 +340,88 @@ immediate: true

value: function initFeedback() {
var bridge;
return _regeneratorRuntime.async(function initFeedback$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return _regeneratorRuntime.awrap(this.waitForPluginsReady());
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee3() {
var bridge;
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.waitForPluginsReady();
case 2:
bridge = this.getPluginInstance(_BridgePlugin);
this.startWatchFeedbackQueue({
showToast: function showToast(item) {
return new Promise(function (resolve) {
bridge.call('showToast', item);
case 2:
bridge = this.getPluginInstance(_BridgePlugin);
this.startWatchFeedbackQueue({
showToast: function showToast(item) {
return new Promise(function (resolve) {
bridge.call('showToast', item);
if (item.isBlock || item.duration) {
if (item.duration) {
setTimeout(function () {
return resolve();
}, item.duration);
if (item.isBlock || item.duration) {
if (item.duration) {
setTimeout(function () {
return resolve();
}, item.duration);
} else {
resolve();
bridge.call('hideToast');
}
} else {
bridge.call('hideToast');
resolve();
bridge.call('hideToast');
}
} else {
bridge.call('hideToast');
resolve();
}
});
},
alert: function alert(item) {
return new Promise(function (resolve) {
if (item.isBlock) {
bridge.call('alert', _objectSpread({}, item, {
complete: function complete() {
resolve();
});
},
alert: function alert(item) {
return new Promise(function (resolve) {
if (item.isBlock) {
bridge.call('alert', Object.assign(Object.assign({}, item), {
complete: function complete() {
resolve();
if (item.complete) {
item.complete();
}
}
}));
} else {
bridge.call('alert', item);
resolve();
}
});
},
confirm: function confirm(item) {
return new Promise(function (resolve) {
bridge.call('confirm', Object.assign(Object.assign({}, item), {
confirmButtonText: item.okButtonText,
complete: function complete(result) {
if (item.isBlock) {
resolve();
}
if (item.complete) {
item.complete();
item.complete(result.confirm ? {
ok: true,
cancel: false
} : {
ok: false,
cancel: true
});
}
}
}));
} else {
bridge.call('alert', item);
resolve();
}
});
},
confirm: function confirm(item) {
return new Promise(function (resolve) {
bridge.call('confirm', _objectSpread({}, item, {
confirmButtonText: item.okButtonText,
complete: function complete(result) {
if (item.isBlock) {
resolve();
}
if (item.complete) {
item.complete(result.confirm ? {
if (!item.isBlock) {
resolve();
}
});
},
prompt: function prompt(item) {
return new Promise(function (resolve) {
bridge.call('prompt', Object.assign(Object.assign({}, item), {
message: item.content || 'prompt',
success: function success(result) {
item.complete && item.complete(result.ok ? {
ok: true,
cancel: false
cancel: false,
inputValue: result.inputValue
} : {

@@ -369,43 +431,22 @@ ok: false,

});
}
}
}));
},
fail: function fail() {
item.complete && item.complete({
ok: false,
cancel: false
});
},
complete: resolve
}));
});
}
});
if (!item.isBlock) {
resolve();
}
});
},
prompt: function prompt(item) {
return new Promise(function (resolve) {
bridge.call('prompt', _objectSpread({}, item, {
message: item.content || 'prompt',
success: function success(result) {
item.complete && item.complete(result.ok ? {
ok: true,
cancel: false,
inputValue: result.inputValue
} : {
ok: false,
cancel: true
});
},
fail: function fail() {
item.complete && item.complete({
ok: false,
cancel: false
});
},
complete: resolve
}));
});
}
});
case 4:
case "end":
return _context3.stop();
case 4:
case "end":
return _context3.stop();
}
}
}
}, null, this);
}, _callee3, this);
}));
}

@@ -412,0 +453,0 @@ /**

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

import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _createMiniApp from "@goldfishjs/reactive-connect/lib/createMiniApp";

@@ -6,6 +5,34 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

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());
});
};
/**

@@ -23,43 +50,47 @@ * Connect the AppStore with the App.

_attachLogic(appOptions, 'onLaunch', 'after', function _callee(options) {
var store;
return _regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
store = this.store;
store.isInitLoading = true;
store.updatePages(options);
_context.next = 5;
return _regeneratorRuntime.awrap(store.waitForReady());
_attachLogic(appOptions, 'onLaunch', 'after', function (options) {
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
var store;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
store = this.store;
store.isInitLoading = true;
store.updatePages(options);
_context.next = 5;
return store.waitForReady();
case 5:
store.initFeedback();
_context.prev = 6;
_context.next = 9;
return _regeneratorRuntime.awrap(store.fetchInitData());
case 5:
store.initFeedback();
_context.prev = 6;
_context.next = 9;
return store.fetchInitData();
case 9:
_context.next = 14;
break;
case 9:
_context.next = 14;
break;
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](6);
throw _context.t0;
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](6);
throw _context.t0;
case 14:
_context.prev = 14;
store.isInitLoading = false;
return _context.finish(14);
case 14:
_context.prev = 14;
store.isInitLoading = false;
return _context.finish(14);
case 17:
case "end":
return _context.stop();
case 17:
case "end":
return _context.stop();
}
}
}
}, null, this, [[6, 11, 14, 17]]);
}, _callee, this, [[6, 11, 14, 17]]);
}));
});
return _createMiniApp(storeClass, appOptions, _objectSpread({}, options, {
return _createMiniApp(storeClass, appOptions, Object.assign(Object.assign({}, options), {
afterCreateStore: function afterCreateStore(view, store) {

@@ -66,0 +97,0 @@ store.setConfig(config);

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

import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _createMiniComponent from "@goldfishjs/reactive-connect/lib/createMiniComponent";

@@ -7,6 +6,34 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

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());
});
};
/**

@@ -24,48 +51,52 @@ * Connect ComponentStore with Component.

_attachLogic(componentOptions, enterKey, 'after', function _callee() {
var store;
return _regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
store = this.store;
store.isInitLoading = true;
_context.t0 = store.globalStore;
_attachLogic(componentOptions, enterKey, 'after', function () {
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
var store;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
store = this.store;
store.isInitLoading = true;
_context.t0 = store.globalStore;
if (!_context.t0) {
if (!_context.t0) {
_context.next = 6;
break;
}
_context.next = 6;
break;
}
return store.globalStore.waitForReady();
_context.next = 6;
return _regeneratorRuntime.awrap(store.globalStore.waitForReady());
case 6:
_context.prev = 6;
_context.next = 9;
return store.fetchInitData();
case 6:
_context.prev = 6;
_context.next = 9;
return _regeneratorRuntime.awrap(store.fetchInitData());
case 9:
_context.next = 14;
break;
case 9:
_context.next = 14;
break;
case 11:
_context.prev = 11;
_context.t1 = _context["catch"](6);
throw _context.t1;
case 11:
_context.prev = 11;
_context.t1 = _context["catch"](6);
throw _context.t1;
case 14:
_context.prev = 14;
store.isInitLoading = false;
return _context.finish(14);
case 14:
_context.prev = 14;
store.isInitLoading = false;
return _context.finish(14);
case 17:
case "end":
return _context.stop();
case 17:
case "end":
return _context.stop();
}
}
}
}, null, this, [[6, 11, 14, 17]]);
}, _callee, this, [[6, 11, 14, 17]]);
}));
});
return _createMiniComponent(storeClass, componentOptions, _objectSpread({}, options, {
return _createMiniComponent(storeClass, componentOptions, Object.assign(Object.assign({}, options), {
afterCreateStore: function afterCreateStore(view, store) {

@@ -72,0 +103,0 @@ options && options.afterCreateStore && options.afterCreateStore(view, store);

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

import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _createMiniPage from "@goldfishjs/reactive-connect/lib/createMiniPage";

@@ -6,6 +5,34 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

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());
});
};
/**

@@ -22,51 +49,55 @@ * Connect PageStore with Page.

_attachLogic(pageOptions, 'onLoad', 'after', function _callee(query) {
var store;
return _regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
store = this.store;
store.globalStore && store.globalStore.updatePages({
query: query
});
store.isInitLoading = true;
_context.t0 = store.globalStore;
_attachLogic(pageOptions, 'onLoad', 'after', function (query) {
return __awaiter(this, void 0, void 0,
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee() {
var store;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
store = this.store;
store.globalStore && store.globalStore.updatePages({
query: query
});
store.isInitLoading = true;
_context.t0 = store.globalStore;
if (!_context.t0) {
if (!_context.t0) {
_context.next = 7;
break;
}
_context.next = 7;
break;
}
return store.globalStore.waitForReady();
_context.next = 7;
return _regeneratorRuntime.awrap(store.globalStore.waitForReady());
case 7:
_context.prev = 7;
_context.next = 10;
return store.fetchInitData();
case 7:
_context.prev = 7;
_context.next = 10;
return _regeneratorRuntime.awrap(store.fetchInitData());
case 10:
_context.next = 15;
break;
case 10:
_context.next = 15;
break;
case 12:
_context.prev = 12;
_context.t1 = _context["catch"](7);
throw _context.t1;
case 12:
_context.prev = 12;
_context.t1 = _context["catch"](7);
throw _context.t1;
case 15:
_context.prev = 15;
store.isInitLoading = false;
return _context.finish(15);
case 15:
_context.prev = 15;
store.isInitLoading = false;
return _context.finish(15);
case 18:
case "end":
return _context.stop();
case 18:
case "end":
return _context.stop();
}
}
}
}, null, this, [[7, 12, 15, 18]]);
}, _callee, this, [[7, 12, 15, 18]]);
}));
});
return _createMiniPage(storeClass, pageOptions, _objectSpread({}, options, {
return _createMiniPage(storeClass, pageOptions, Object.assign(Object.assign({}, options), {
afterCreateStore: function afterCreateStore(view, store) {

@@ -73,0 +104,0 @@ options && options.afterCreateStore && options.afterCreateStore(view, store);

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

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

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

@@ -24,0 +24,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