import { DaffExternalScriptTestingService } from '@daffodil/core/external-script/testing'
A service for loading external scripts into the document.
@Injectable()
class DaffExternalScriptTestingService implements DaffExternalScriptServiceInterface {
load(
name: string
script: DaffExternalScript
): Observable<boolean>
}
Observable<boolean>
Parameter | name: string |
---|---|
Description |
Parameter | script: DaffExternalScript |
---|---|
Description |
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);
},
});