canary/app/home/home.ts
2025-08-16 14:02:39 +03:00

37 lines
956 B
TypeScript

namespace $ {
export class $hd_canary_app_home extends $hyoo_crus_home.with({
// Aliases: $hyoo_crus_dict_to( $hyoo_crus_list_str ),
// Stat: $hyoo_crus_atom_ref_to( ()=> $hyoo_crus_app_stat ),
Sites: $hyoo_crus_list_ref_to( ()=> $hd_canary_app_home_site ),
}) {}
export class $hd_canary_app_home_site extends $hyoo_crus_dict.with( {
/** Type of value */
domain: $hyoo_crus_atom_str,
last_ping_time: $hyoo_crus_atom_time,
last_ping_status: $hyoo_crus_atom_bool,
}) {
@ $mol_mem
tick() {
this.$.$mol_state_time.now( 5000 )
if(this.can_change()) {
const domain = this.domain()!.val() as string
// console.log({action:"tick", domain: domain, })//this.last_ping_time()?.val()})
const request = $mol_fetch.response(domain)
this.last_ping_status(null)!.val( request.code() == 200)
this.last_ping_time(null)!.val( new $mol_time_moment)
// console.log({status: request.code()})
}
}
}
}