I can run a query in my main.ts file with another ts file, but I cannot pull the result of the query into another file. How can I do that?
My main.ts;
async function getAllTips() {
const tips: any = []; // i need get "tips" array in another ts file
try {
const snapshot = await ref
.child("tips")
.orderByChild("cont")
.startAt(1)
.endAt(5)
.get();
if (snapshot.val()) {
for (let key in snapshot.val()) {
let value = snapshot.val()[key];
tips.push(value.get("tips"));
}
}
} finally {
return tips;
}
}
async function asyncForArray(array,callback){
for(let i=0;i<array.length;i++){
await callback(array[i],i)
}
}
async function asyncFor(obj,callback){
for(let key in obj){
await callback(
obj[key],key
)
}
}
export {
getAllTips
}
I need get "tips" array in another file. How can i do that? Best regards.