The base class for long living objects. Every such object has an unique user friendly id like $my_app.root(0).List().Task("123")
. This id is also a script with which we can get a link to an object from the browser console.
This is very handy for debugging. To have a correct identifiers, it's recommended to create an object through a factory wrapped by decorator $mol_mem at "owns" object:
namespace $ {
export class $my_app extends $mol_view {
@ $mol_mem
List() {
return new $mol_list()
}
}
}
This identifier is used everywhere, in particular is outputted automatically while logging:
10:16:43 $my_app.root(0).List() pull
10:16:43 $my_app.root(0).List() push [$my_list, undefined]
10:16:44 $my_app.root(0).List().dom_tree() pull
10:16:44 $my_app.root(0).List().dom_tree() push [div, undefined]
For outputting own messages into log, it is recommended to use log
method:
namespace $ {
export class $my_app extends $mol_view {
constructor() {
this.log([ 'hello' ]) // 10:16:42 $my_app.Root(0) hello
}
}
}