@azrico/webobject 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,52 +1,52 @@
1
- # deus-object
2
-
3
- > Some useful object functions
4
-
5
- ## Install
6
-
7
- ```bash
8
- npm install --save deus-object
9
- ```
10
-
11
- ## Functions
12
-
13
- ```js
14
- object_clone(object);
15
- object_first(object);
16
- object_update(a, b);
17
- object_delta(a, b);
18
- object_has_delta(object);
19
- object_equals(a, b);
20
- isEmpty(object);
21
- ```
22
-
23
- ## Usage
24
-
25
- ```js
26
- import React, { Component } from 'react'
27
- import { View } from 'react-native'
28
- import FuncObject from 'deus-object'
29
-
30
- class Example extends Component {
31
-
32
- let eq1=FuncObject.object_equals({a:"b"},{a:"b"});//true
33
- let eq2=FuncObject.object_equals({a:"b"},{a:"c"});//false
34
-
35
- let ie1=FuncObject.isEmpty({}); //true
36
- let ie2=FuncObject.isEmpty([]); //true
37
- let ie3=FuncObject.isEmpty(null);//true
38
- let ie4=FuncObject.isEmpty({test:"a"});//false
39
-
40
- let if1=FuncObject.object_first({a:"a",b:"b",c:"c"});// a:"a"
41
- let if2=FuncObject.object_first([1,2,3,4]);//1
42
-
43
-
44
- render() {
45
- return <View></View>
46
- }
47
- }
48
- ```
49
-
50
- ## License
51
-
52
- MIT © [](https://github.com/)
1
+ # deus-object
2
+
3
+ > Some useful object functions
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save deus-object
9
+ ```
10
+
11
+ ## Functions
12
+
13
+ ```js
14
+ object_clone(object);
15
+ object_first(object);
16
+ object_update(a, b);
17
+ object_delta(a, b);
18
+ object_has_delta(object);
19
+ object_equals(a, b);
20
+ isEmpty(object);
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```js
26
+ import React, { Component } from 'react'
27
+ import { View } from 'react-native'
28
+ import FuncObject from 'deus-object'
29
+
30
+ class Example extends Component {
31
+
32
+ let eq1=FuncObject.object_equals({a:"b"},{a:"b"});//true
33
+ let eq2=FuncObject.object_equals({a:"b"},{a:"c"});//false
34
+
35
+ let ie1=FuncObject.isEmpty({}); //true
36
+ let ie2=FuncObject.isEmpty([]); //true
37
+ let ie3=FuncObject.isEmpty(null);//true
38
+ let ie4=FuncObject.isEmpty({test:"a"});//false
39
+
40
+ let if1=FuncObject.object_first({a:"a",b:"b",c:"c"});// a:"a"
41
+ let if2=FuncObject.object_first([1,2,3,4]);//1
42
+
43
+
44
+ render() {
45
+ return <View></View>
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## License
51
+
52
+ MIT © [](https://github.com/)
@@ -7,6 +7,8 @@ import WebObject from "./WebObject";
7
7
  export declare class WebObjectManager<T extends WebObject> extends ObjectManager<T> {
8
8
  static readonly __web_path: string;
9
9
  static readonly __web_type: string;
10
+ static readonly __save_message: boolean;
11
+ constructor();
10
12
  /**
11
13
  * Update meta value of this object , meta data is stored in meta_data variable
12
14
  * @param key
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = exports.WebObjectManager = void 0;
7
7
  var _ObjectManager2 = _interopRequireDefault(require("../structs/ObjectManager"));
8
+ var _global = require("@azrico/global");
8
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
10
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
11
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
@@ -29,28 +30,67 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
29
30
  var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
30
31
  _inherits(WebObjectManager, _ObjectManager);
31
32
  var _super = _createSuper(WebObjectManager);
33
+ /* -------------------------------------------------------------------------- */
32
34
  function WebObjectManager() {
35
+ var _this;
33
36
  _classCallCheck(this, WebObjectManager);
34
- return _super.apply(this, arguments);
37
+ _this = _super.call(this);
38
+ /* ---------------- should we display a message after saving ? -------------- */
39
+ if (_this.constructor["__save_message"]) {
40
+ _this.event_add("on_save", "onsave_sendmsg", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
41
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
42
+ while (1) switch (_context.prev = _context.next) {
43
+ case 0:
44
+ _context.t0 = _this.getSaveResultType();
45
+ _context.next = _context.t0 === "nothing" ? 3 : _context.t0 === "normal" ? 6 : 9;
46
+ break;
47
+ case 3:
48
+ _context.next = 5;
49
+ return _global.gfunc.run_action("show_message", {
50
+ message: "Nothing to save",
51
+ type: "info"
52
+ });
53
+ case 5:
54
+ return _context.abrupt("return", _context.sent);
55
+ case 6:
56
+ _context.next = 8;
57
+ return _global.gfunc.run_action("show_message", {
58
+ message: "Saved",
59
+ type: "success"
60
+ });
61
+ case 8:
62
+ return _context.abrupt("return", _context.sent);
63
+ case 9:
64
+ _context.next = 11;
65
+ return _global.gfunc.run_action("show_message", {
66
+ message: "Not saved",
67
+ type: "error"
68
+ });
69
+ case 11:
70
+ return _context.abrupt("return", _context.sent);
71
+ case 12:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }, _callee);
76
+ })));
77
+ }
78
+ return _this;
35
79
  }
80
+ /* -------------------------------------------------------------------------- */
81
+ /* Meta data */
82
+ /* -------------------------------------------------------------------------- */
83
+ /**
84
+ * Update meta value of this object , meta data is stored in meta_data variable
85
+ * @param key
86
+ * @param value
87
+ * @param createIfNotExists should we create a new meta if key does not exist
88
+ * @param sendChange
89
+ * @returns
90
+ */
36
91
  _createClass(WebObjectManager, [{
37
92
  key: "setMetaValue",
38
- value:
39
- //we use this as backup
40
-
41
- /* -------------------------------------------------------------------------- */
42
- /* -------------------------------------------------------------------------- */
43
- /* Meta data */
44
- /* -------------------------------------------------------------------------- */
45
- /**
46
- * Update meta value of this object , meta data is stored in meta_data variable
47
- * @param key
48
- * @param value
49
- * @param createIfNotExists should we create a new meta if key does not exist
50
- * @param sendChange
51
- * @returns
52
- */
53
- function setMetaValue(key, value) {
93
+ value: function setMetaValue(key, value) {
54
94
  var _this$obj;
55
95
  var createIfNotExists = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
56
96
  var sendChange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
@@ -72,27 +112,27 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
72
112
  }, {
73
113
  key: "get_deltaObject",
74
114
  value: function () {
75
- var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
115
+ var _get_deltaObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
76
116
  var _this$obj4;
77
- return _regeneratorRuntime().wrap(function _callee$(_context) {
78
- while (1) switch (_context.prev = _context.next) {
117
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
118
+ while (1) switch (_context2.prev = _context2.next) {
79
119
  case 0:
80
- _context.next = 2;
120
+ _context2.next = 2;
81
121
  return (_this$obj4 = this.obj) === null || _this$obj4 === void 0 ? void 0 : _this$obj4.get_deltaObject();
82
122
  case 2:
83
- _context.t0 = _context.sent;
84
- if (_context.t0) {
85
- _context.next = 5;
123
+ _context2.t0 = _context2.sent;
124
+ if (_context2.t0) {
125
+ _context2.next = 5;
86
126
  break;
87
127
  }
88
- _context.t0 = {};
128
+ _context2.t0 = {};
89
129
  case 5:
90
- return _context.abrupt("return", _context.t0);
130
+ return _context2.abrupt("return", _context2.t0);
91
131
  case 6:
92
132
  case "end":
93
- return _context.stop();
133
+ return _context2.stop();
94
134
  }
95
- }, _callee, this);
135
+ }, _callee2, this);
96
136
  }));
97
137
  function get_deltaObject() {
98
138
  return _get_deltaObject.apply(this, arguments);
@@ -102,27 +142,27 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
102
142
  }, {
103
143
  key: "Save",
104
144
  value: function () {
105
- var _Save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
145
+ var _Save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
106
146
  var _this$obj5;
107
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
108
- while (1) switch (_context2.prev = _context2.next) {
147
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
148
+ while (1) switch (_context3.prev = _context3.next) {
109
149
  case 0:
110
- _context2.next = 2;
150
+ _context3.next = 2;
111
151
  return (_this$obj5 = this.obj) === null || _this$obj5 === void 0 ? void 0 : _this$obj5.Save();
112
152
  case 2:
113
- _context2.t0 = _context2.sent;
114
- if (_context2.t0) {
115
- _context2.next = 5;
153
+ _context3.t0 = _context3.sent;
154
+ if (_context3.t0) {
155
+ _context3.next = 5;
116
156
  break;
117
157
  }
118
- _context2.t0 = false;
158
+ _context3.t0 = false;
119
159
  case 5:
120
- return _context2.abrupt("return", _context2.t0);
160
+ return _context3.abrupt("return", _context3.t0);
121
161
  case 6:
122
162
  case "end":
123
- return _context2.stop();
163
+ return _context3.stop();
124
164
  }
125
- }, _callee2, this);
165
+ }, _callee3, this);
126
166
  }));
127
167
  function Save() {
128
168
  return _Save.apply(this, arguments);
@@ -132,16 +172,16 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
132
172
  }, {
133
173
  key: "Load",
134
174
  value: function () {
135
- var _Load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(search) {
136
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
137
- while (1) switch (_context3.prev = _context3.next) {
175
+ var _Load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(search) {
176
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
177
+ while (1) switch (_context4.prev = _context4.next) {
138
178
  case 0:
139
179
  throw Error("load not implented");
140
180
  case 1:
141
181
  case "end":
142
- return _context3.stop();
182
+ return _context4.stop();
143
183
  }
144
- }, _callee3);
184
+ }, _callee4);
145
185
  }));
146
186
  function Load(_x) {
147
187
  return _Load.apply(this, arguments);
@@ -179,32 +219,32 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
179
219
  }, {
180
220
  key: "onNew",
181
221
  value: function () {
182
- var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
222
+ var _onNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
183
223
  var _this$obj8;
184
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
185
- while (1) switch (_context4.prev = _context4.next) {
224
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
225
+ while (1) switch (_context5.prev = _context5.next) {
186
226
  case 0:
187
227
  if (this.canModify) {
188
228
  (_this$obj8 = this.obj) === null || _this$obj8 === void 0 ? void 0 : _this$obj8.setOriginal();
189
229
  }
190
- _context4.next = 3;
230
+ _context5.next = 3;
191
231
  return this.event_run("on_new");
192
232
  case 3:
193
- _context4.next = 5;
233
+ _context5.next = 5;
194
234
  return this.event_run("on_change", true);
195
235
  case 5:
196
- _context4.next = 7;
236
+ _context5.next = 7;
197
237
  return this.event_run("on_after_new");
198
238
  case 7:
199
- _context4.next = 9;
239
+ _context5.next = 9;
200
240
  return Promise.resolve(true);
201
241
  case 9:
202
- return _context4.abrupt("return", _context4.sent);
242
+ return _context5.abrupt("return", _context5.sent);
203
243
  case 10:
204
244
  case "end":
205
- return _context4.stop();
245
+ return _context5.stop();
206
246
  }
207
- }, _callee4, this);
247
+ }, _callee5, this);
208
248
  }));
209
249
  function onNew() {
210
250
  return _onNew.apply(this, arguments);
@@ -219,32 +259,32 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
219
259
  }, {
220
260
  key: "onLoad",
221
261
  value: function () {
222
- var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
262
+ var _onLoad = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
223
263
  var _this$obj9;
224
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
225
- while (1) switch (_context5.prev = _context5.next) {
264
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
265
+ while (1) switch (_context6.prev = _context6.next) {
226
266
  case 0:
227
267
  if (this.canModify) {
228
268
  (_this$obj9 = this.obj) === null || _this$obj9 === void 0 ? void 0 : _this$obj9.setOriginal();
229
269
  }
230
- _context5.next = 3;
270
+ _context6.next = 3;
231
271
  return this.event_run("on_load");
232
272
  case 3:
233
- _context5.next = 5;
273
+ _context6.next = 5;
234
274
  return this.event_run("on_change", true);
235
275
  case 5:
236
- _context5.next = 7;
276
+ _context6.next = 7;
237
277
  return this.event_run("on_after_load");
238
278
  case 7:
239
- _context5.next = 9;
279
+ _context6.next = 9;
240
280
  return Promise.resolve(true);
241
281
  case 9:
242
- return _context5.abrupt("return", _context5.sent);
282
+ return _context6.abrupt("return", _context6.sent);
243
283
  case 10:
244
284
  case "end":
245
- return _context5.stop();
285
+ return _context6.stop();
246
286
  }
247
- }, _callee5, this);
287
+ }, _callee6, this);
248
288
  }));
249
289
  function onLoad() {
250
290
  return _onLoad.apply(this, arguments);
@@ -259,28 +299,28 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
259
299
  }, {
260
300
  key: "onSave",
261
301
  value: function () {
262
- var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
263
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
264
- while (1) switch (_context6.prev = _context6.next) {
302
+ var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
303
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
304
+ while (1) switch (_context7.prev = _context7.next) {
265
305
  case 0:
266
- _context6.next = 2;
306
+ _context7.next = 2;
267
307
  return this.event_run("on_save");
268
308
  case 2:
269
- _context6.next = 4;
309
+ _context7.next = 4;
270
310
  return this.event_run("on_change", true);
271
311
  case 4:
272
- _context6.next = 6;
312
+ _context7.next = 6;
273
313
  return this.event_run("on_after_save");
274
314
  case 6:
275
- _context6.next = 8;
315
+ _context7.next = 8;
276
316
  return Promise.resolve(true);
277
317
  case 8:
278
- return _context6.abrupt("return", _context6.sent);
318
+ return _context7.abrupt("return", _context7.sent);
279
319
  case 9:
280
320
  case "end":
281
- return _context6.stop();
321
+ return _context7.stop();
282
322
  }
283
- }, _callee6, this);
323
+ }, _callee7, this);
284
324
  }));
285
325
  function onSave() {
286
326
  return _onSave.apply(this, arguments);
@@ -291,7 +331,9 @@ var WebObjectManager = /*#__PURE__*/function (_ObjectManager) {
291
331
  return WebObjectManager;
292
332
  }(_ObjectManager2["default"]);
293
333
  exports.WebObjectManager = WebObjectManager;
334
+ //we use this as backup
294
335
  _defineProperty(WebObjectManager, "__web_path", "");
295
336
  _defineProperty(WebObjectManager, "__web_type", "");
337
+ _defineProperty(WebObjectManager, "__save_message", true);
296
338
  var _default = WebObjectManager;
297
339
  exports["default"] = _default;
@@ -12,15 +12,14 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
12
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
13
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
14
  var ObjectArray = /*#__PURE__*/function () {
15
- /* -------------------------------------------------------------------------- */
16
- /* Values */
17
- /* -------------------------------------------------------------------------- */
18
-
19
15
  /* -------------------------------------------------------------------------- */
20
16
  /* Base */
21
17
  /* -------------------------------------------------------------------------- */
22
18
  function ObjectArray(initObject, mapto_type) {
23
19
  _classCallCheck(this, ObjectArray);
20
+ /* -------------------------------------------------------------------------- */
21
+ /* Values */
22
+ /* -------------------------------------------------------------------------- */
24
23
  _defineProperty(this, "objArray", []);
25
24
  this.setObjects(initObject, mapto_type);
26
25
  }
@@ -859,8 +859,11 @@ function _setSaveResultObject2(toObj) {
859
859
  this.__saveResultObject = toObj;
860
860
  }
861
861
  _defineProperty(SimpleObject, "__cache_name", void 0);
862
+ //these properties should not be changed and are usually set by server
862
863
  _defineProperty(SimpleObject, "__unchangeables", void 0);
864
+ //these properties can be directly changed and are included in deltaObject
863
865
  _defineProperty(SimpleObject, "__changeables", void 0);
866
+ //these properties usually are not directly changed and sometimes are included in deltaObject
864
867
  _defineProperty(SimpleObject, "__extraProperties", void 0);
865
868
  _defineProperty(SimpleObject, "__use_delta", true);
866
869
  var _default = SimpleObject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/webobject",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Stateful object",
5
5
  "author": "Azrideus",
6
6
  "license": "MIT",