DaffExternalScriptTestingService

A service for loading external scripts into the document.

Usage example

The following loads an external script into the document.


import { DaffExternalScriptTestingService } from '@daffodil/core/external-script/testing';

const externalScriptService = new DaffExternalScriptTestingService();

externalScriptService.load(TestScripts.SUCCESS, {
  src: 'https://example.com/script.js',
  async: true,
  defer: false,
  'data-custom-attribute': 'value',
}).subscribe({
  next: (result) => {
    console.log('Script loaded successfully:', result);
  },
  error: (error) => {
    console.error('Error loading script:', error);
  },
});

Properties

Name Type Description
load Observable<boolean>
Graycore, LLC © 2018 - 2024. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.