HumanBreak/packages-user/client-modules/src/utils/use.ts
2025-05-12 21:39:50 +08:00

16 lines
326 B
TypeScript

import { onUnmounted } from 'vue';
import { WeatherController } from '../weather';
let weatherId = 0;
export function useWeather(): [WeatherController] {
const weather = new WeatherController(`@weather-${weatherId}`);
weatherId++;
onUnmounted(() => {
weather.destroy();
});
return [weather];
}