const emptyFunction = () => {};

try {
    if (document) {
        document.head.appendChild = emptyFunction;
        document.createElement = createElement;
    }
} catch (error) {
    this.document = {
        head: {
            appendChild: emptyFunction
        },
        createElement
    };
}

function createElement() {
    let obj = {
        setAttribute: emptyFunction
    };
    console.log('---createElement---');
    Object.defineProperty(obj, 'src', {
        set(value) {
            console.log('---createElement set---', value);
            const fs = bl.getFileSystemManager && bl.getFileSystemManager();
            
            fs.readFile({
                filePath: value,
                encoding: 'utf-8',
                success(res) {
                    console.log('---readfile success---');
                    eval(res.data);
                },
                fail(e) {
                    console.log('---readfile fail---', e);
                }
            });
        }
    });
    return obj;
}