This gist provides a useAsyncComputed
function which allows to create asynchronous dependencies on reactive values (using Vue 3's Composition API).
Requires at least Vue 3.0 and TypeScript 4.0.
import { mapState as originalMapState } from "vuex"; | |
// Utilities to map the record fields to their function return types | |
// See https://github.com/microsoft/TypeScript/issues/15763#issuecomment-364205392 | |
type ReturnType<T> = T extends (...args: any[]) => infer R ? R : never; | |
type MappedOutputs<T> = { | |
[P in keyof T]: () => ReturnType<T[P]>; // This is a lambda so it fulfills vuex's contract | |
}; | |
type MapperRecord<S> = Record<string, (store: S) => any>; |
<?php | |
$municipios = array( | |
"antioaquia" => array( | |
'CO1' => 'Abejorral - Antioquia', | |
'CO3' => 'Abriaquí - Antioquia', | |
'CO23' => 'Alejandría - Antioquia', | |
'CO33' => 'Amagá - Antioquia', | |
'CO34' => 'Amalfi - Antioquia', | |
'CO39' => 'Andes - Antioquia', |
var months = []; | |
for( var i = 0; i < 12; i++ ){ | |
months.push( new Date(0,i).toLocaleString({},{month:'short'}) ); | |
// you can also pass a local like : "en-US" instead of an empty object `{}`. | |
// an empty object triggers the system's auto-detection | |
} | |
console.log(months); |