Skip to content

Commit 1d93bfd

Browse files
committed
feat: update some related names
1 parent c83d76c commit 1d93bfd

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# vue-amap [![npm](https://img.shields.io/npm/v/@refinist/vue-amap.svg?style=flat&colorA=2b99ff&colorB=387aff)](https://npmjs.com/package/@refinist/vue-amap)
22

3-
Using Vue3 component to use AMap
3+
Using Vue3 component to use Amap
44

55
## Features
66

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@refinist/vue-amap",
33
"version": "0.0.2",
4-
"description": "Using Vue3 component to use AMap",
4+
"description": "Using Vue3 component to use Amap",
55
"keywords": [
66
"vue",
77
"amap",

playground/src/App.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ onMounted(() => {
88
console.log('amapRef :>> ', amapRef.value);
99
});
1010
11-
const { amapInit, getAmap, amapStatus, amapStatusChange, whenAMapReady } =
11+
const { amapInit, getAmap, amapStatus, amapStatusChange, whenAmapReady } =
1212
useAmap();
1313
1414
watchEffect(() => {
@@ -35,8 +35,8 @@ const handleError = e => {};
3535
// Test the edge case of operating the map before it is fully loaded
3636
let marker;
3737
const handleOperateMapBeforeLoadedMaybe = async () => {
38-
// whenAMapReady Usage 1
39-
// whenAMapReady(({ map, AMap }) => {
38+
// whenAmapReady Usage 1
39+
// whenAmapReady(({ map, AMap }) => {
4040
// if (!marker) {
4141
// marker = new AMap.Marker({
4242
// icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
@@ -47,8 +47,8 @@ const handleOperateMapBeforeLoadedMaybe = async () => {
4747
// }
4848
// });
4949
50-
// whenAMapReady Usage 2
51-
const { map, AMap } = await whenAMapReady();
50+
// whenAmapReady Usage 2
51+
const { map, AMap } = await whenAmapReady();
5252
if (!marker) {
5353
marker = new AMap.Marker({
5454
icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',

src/Amap.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { computed, onMounted, onUnmounted, ref } from 'vue';
33
import AMapLoader from '@amap/amap-jsapi-loader';
44
import { defaultOptions } from './defaultOptions';
5-
import { sleep, toCssUnit } from './utils';
5+
import { toCssUnit } from './utils';
66
import type { Status, Map, AMap } from './types';
77
88
defineOptions({

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type Map = Record<string, any>;
66

77
export type AMap = Record<string, any>;
88

9-
export type Instance = {
9+
export type MapInstance = {
1010
map: Map;
1111
AMap: AMap;
1212
};

src/useAmap.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ref, shallowRef, watch } from 'vue';
2-
import type { Map, AMap, Status, Instance } from './types';
2+
import type { Map, AMap, Status, MapInstance } from './types';
33

44
export const useAmap = () => {
55
const status = ref<Status>('loading');
@@ -11,7 +11,7 @@ export const useAmap = () => {
1111
map: null
1212
});
1313

14-
const init = (e: Instance) => {
14+
const init = (e: MapInstance) => {
1515
instance.value = e;
1616
};
1717
const statusChange = (p: Status) => {
@@ -23,11 +23,11 @@ export const useAmap = () => {
2323

2424
// Ensure operations are performed after the map is ready.
2525
// Can be executed independently of handleComplete to accommodate more business scenarios.
26-
const whenAMapReady = (
27-
cb?: (instance: Instance) => void
28-
): Promise<Instance> => {
29-
let resolve!: (value: Instance) => void;
30-
const p = new Promise<Instance>(_ => (resolve = _));
26+
const whenAmapReady = (
27+
cb?: (instance: MapInstance) => void
28+
): Promise<MapInstance> => {
29+
let resolve!: (value: MapInstance) => void;
30+
const p = new Promise<MapInstance>(_ => (resolve = _));
3131

3232
const { map, AMap } = get();
3333
if (map && AMap) {
@@ -69,6 +69,6 @@ export const useAmap = () => {
6969
amapStatusChange: statusChange,
7070
getAmap: get,
7171
amapStatus: status,
72-
whenAMapReady
72+
whenAmapReady
7373
};
7474
};

0 commit comments

Comments
 (0)