connectedCallback method

  1. @override
void connectedCallback()
override

Implementation

@override
void connectedCallback() async {
  super.connectedCallback();
  int? contextId = ownerDocument.contextId;
  if (contextId == null) return;
  if (src.isNotEmpty) {
    _fetchAndExecuteSource();
  } else if (_type == _MIME_TEXT_JAVASCRIPT || _type == _JAVASCRIPT_MODULE){
    // Eval script context: <script> console.log(1) </script>
    String? script = _collectElementChildText(this);
    if (script != null && script.isNotEmpty) {
      evaluateScripts(contextId, script);
    }
  }
}