42 lines
1 KiB
TypeScript
42 lines
1 KiB
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 */
|
|
url: $hyoo_crus_atom_str,
|
|
title: $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 )
|
|
|
|
console.log(this.land().ref().description)
|
|
|
|
if(this.can_change()) {
|
|
const url = this.url()!.val() as string
|
|
const title = this.title()!.val() as string
|
|
|
|
console.log({action:"tick", url, title })
|
|
|
|
const request = $mol_fetch.response(url)
|
|
this.last_ping_status(null)!.val( request.code() == 200)
|
|
this.last_ping_time(null)!.val( new $mol_time_moment)
|
|
// console.log({status: request.code()})
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|