All files / src/libs native.js

72.73% Statements 8/11
50% Branches 1/2
50% Functions 1/2
72.73% Lines 8/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                  1x       1x 1x 1x 1x 1x   1x   1x            
/**
 * @call native api
 * @author heyli
 * @date 2016.07.30
 */
import global from './gb';
 
export function callApi(url) {
 
    Iif (!global.document) {
        return;
    }
 
    let iframe = document.createElement('iframe');
    iframe.src = url;
    iframe.height = 0;
    iframe.width = 0;
    iframe.style.cssText = 'display: none';
 
    document.body.appendChild(iframe);
 
    setTimeout(function() {
        document.body.removeChild(iframe);
        iframe = null;
    }, 2000);
}