Some additional removal note.
JavaScript restrictions affect dart.
- No link references available
This is a javascript function and in part because of how garbage collection works in the browser: What is JavaScript garbage collection? - Missing weak link (for now)
Another limitation of Java-script and due to the lack of access to the reference counter, the deletion itself is also not an option.
Note. There is Expando, and although it is useful, it is not a weak reference equivalent. A weak link allows you to create ghost links that do not save the object: https://en.wikipedia.org/wiki/Weak_reference . - Missing destructor
javascript does not have this, therefore it does not jerk off.
As others have pointed out, the limitations above are usually nothing.
Since the main eventloop can keep objects alive, careless coding can spawn a zombie object; Without a destructor or weakref, some links can accidentally escape your murderous hands and keep the object alive.
import 'dart:html'; import 'dart:async'; import 'dart:developer'; void main() { var e = new XXX(); var ce = new CustomEvent('custom-event'); var s = new Stream.periodic(new Duration(microseconds: 10000),(count) { print(count); window.dispatchEvent(ce); return count; }); StreamSubscription ss = s.listen((count){print('stream runnig; ${count}_th run');});
The above code prints below in a forever loop (unless you uncomment the two lines):
.... hi VM33:1 Instance of 'XXX' VM34:1 stream runnig; 751_th run VM34:1 752 VM33:1 hi VM33:1 Instance of 'XXX' VM34:1 stream runnig; 752_th run ......
I don’t know if object e will be saved without printing (this), maybe only related objects are stored from the garbage collection.
In any case, with more complex code, manual cleaning is required, and I want one of the three missing functions to be there, but not.
Removal can really be difficult.
TastyCatFood
source share