@jtigernova-npm/tiffany-vue 1.1.2 → 1.2.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.
@@ -1,20 +1,16 @@
1
1
  import { type Ref } from "vue";
2
2
  export interface BaseState {
3
+ allowLoad: Ref<boolean>;
3
4
  loading: Ref<boolean>;
4
5
  onLoad: () => Promise<void>;
5
6
  load: () => void;
6
7
  }
7
- export interface BaseLoadable {
8
- loaded: boolean;
9
- loading: Ref<boolean>;
10
- onLoad: () => Promise<void>;
11
- }
12
- export declare function getBaseLoadableHelper(): {
13
- loaded: boolean;
8
+ export declare function getBaseStateOpts(): {
9
+ allowLoad: Ref<boolean>;
14
10
  loading: Ref<boolean>;
15
11
  onLoad: () => Promise<void>;
16
12
  };
17
- export declare function getBaseStateHelper(loadable: BaseLoadable): {
13
+ export declare function getBaseStateHelper(baseState: BaseState): {
18
14
  load: () => void;
19
15
  };
20
16
  export interface TrackableScroll {
@@ -1,8 +1,13 @@
1
1
  import { logDebug, logErrorAlways } from "@jtigernova-npm/tiffany";
2
2
  import { ref } from "vue";
3
- export function getBaseLoadableHelper() {
3
+ // export interface BaseLoadable {
4
+ // allowLoad: boolean;
5
+ // loading: Ref<boolean>;
6
+ // onLoad: () => Promise<void>;
7
+ // }
8
+ export function getBaseStateOpts() {
4
9
  return {
5
- loaded: false,
10
+ allowLoad: ref(true),
6
11
  loading: ref(false),
7
12
  onLoad: () => {
8
13
  logDebug("nothing to load. skipping...");
@@ -10,18 +15,18 @@ export function getBaseLoadableHelper() {
10
15
  },
11
16
  };
12
17
  }
13
- export function getBaseStateHelper(loadable) {
18
+ export function getBaseStateHelper(baseState) {
14
19
  return {
15
20
  load() {
16
- if (loadable.loaded)
21
+ if (!baseState.allowLoad)
17
22
  return;
18
- loadable
23
+ baseState
19
24
  .onLoad()
20
25
  .then(() => {
21
- logDebug("getBaseStateHelper.onLoad() done");
26
+ logDebug("BaseState.onLoad() done");
22
27
  })
23
28
  .catch((reason) => {
24
- logErrorAlways("getBaseStateHelper.load() error", reason);
29
+ logErrorAlways("BaseState.load() error", reason);
25
30
  });
26
31
  },
27
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jtigernova-npm/tiffany-vue",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "module": "out/index.js",
5
5
  "type": "module",
6
6
  "typings": "index.d.ts",
@@ -12,8 +12,8 @@
12
12
  "format": "prettier --write src/**",
13
13
  "format-build": "npm run format && npm run build",
14
14
  "test": "echo \"Error: no test specified\" && exit 1",
15
- "tiffany-prepare": "npm run lint && npm run format && npm pack",
16
- "tiffany-publish": "npm run lint && npm run format && npm pack && npm publish --access public && rm *.tgz"
15
+ "tiffany-prepare": "tsc && npm run lint && npm run format && npm pack",
16
+ "tiffany-publish": "tsc && npm run lint && npm run format && npm pack && npm publish --access public && rm *.tgz"
17
17
  },
18
18
  "keywords": [],
19
19
  "author": "JTiger Nova",