@viewfly/core 2.0.0-alpha.7 → 2.0.0

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.
@@ -305,7 +305,8 @@ declare class DynamicRef<T> {
305
305
  */
306
306
  declare function createDynamicRef<T, U = ExtractInstanceType<T>>(callback: RefListener<U>): DynamicRef<U>;
307
307
  declare class StaticRef<T> extends DynamicRef<T> {
308
- readonly current: T | null;
308
+ get current(): T | null;
309
+ private _current;
309
310
  constructor();
310
311
  }
311
312
  declare function createRef<T, U = ExtractInstanceType<T>>(): StaticRef<U>;
@@ -727,30 +727,22 @@ class DynamicRef {
727
727
  function createDynamicRef(callback) {
728
728
  return new DynamicRef(callback);
729
729
  }
730
- const initValue = {};
731
730
  class StaticRef extends DynamicRef {
731
+ get current() {
732
+ return this._current;
733
+ }
732
734
  constructor() {
733
- let value = initValue;
734
- let isInit = false;
735
735
  super(v => {
736
- if (v !== initValue && !isInit) {
737
- value = v;
738
- isInit = true;
739
- }
736
+ this._current = v;
737
+ return () => {
738
+ this._current = null;
739
+ };
740
740
  });
741
- Object.defineProperty(this, "current", {
741
+ Object.defineProperty(this, "_current", {
742
742
  enumerable: true,
743
743
  configurable: true,
744
744
  writable: true,
745
- value: void 0
746
- });
747
- Object.defineProperty(this, 'current', {
748
- get() {
749
- if (value === initValue) {
750
- return null;
751
- }
752
- return value;
753
- }
745
+ value: null
754
746
  });
755
747
  }
756
748
  }
package/bundles/index.js CHANGED
@@ -729,30 +729,22 @@ class DynamicRef {
729
729
  function createDynamicRef(callback) {
730
730
  return new DynamicRef(callback);
731
731
  }
732
- const initValue = {};
733
732
  class StaticRef extends DynamicRef {
733
+ get current() {
734
+ return this._current;
735
+ }
734
736
  constructor() {
735
- let value = initValue;
736
- let isInit = false;
737
737
  super(v => {
738
- if (v !== initValue && !isInit) {
739
- value = v;
740
- isInit = true;
741
- }
738
+ this._current = v;
739
+ return () => {
740
+ this._current = null;
741
+ };
742
742
  });
743
- Object.defineProperty(this, "current", {
743
+ Object.defineProperty(this, "_current", {
744
744
  enumerable: true,
745
745
  configurable: true,
746
746
  writable: true,
747
- value: void 0
748
- });
749
- Object.defineProperty(this, 'current', {
750
- get() {
751
- if (value === initValue) {
752
- return null;
753
- }
754
- return value;
755
- }
747
+ value: null
756
748
  });
757
749
  }
758
750
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viewfly/core",
3
- "version": "2.0.0-alpha.7",
3
+ "version": "2.0.0",
4
4
  "description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",