lib/phantom-helper.js
function get_or_create() {
                if (locked) {
                    setTimeout(wait, 100);
                } else {
                    locked = true;

                    if (phantom_instance != null) {
                        locked = false;
                        resolve(phantom_instance);
                    } else {
                        phantom.create().then((instance) => {
                            phantom_instance = instance;
                            locked = false;
                            resolve(instance);
                        });
                    }
                }
            }
function get_or_create() {
                if (locked) {
                    setTimeout(wait, 100);
                } else {
                    locked = true;

                    if (phantom_instance != null) {
                        locked = false;
                        resolve(phantom_instance);
                    } else {
                        phantom.create().then((instance) => {
                            phantom_instance = instance;
                            locked = false;
                            resolve(instance);
                        });
                    }
                }
            }
function get_or_create ( ) { if ( locked ) { setTimeout ( wait , 100 ) ; } else { locked = true ; if ( phantom_instance != null ) { locked = false ; resolve ( phantom_instance ) ; } else { phantom . create ( ) . then ( ( instance ) => { phantom_instance = instance ; locked = false ; resolve ( instance ) ; } ) ; } } }
Creates an instance of PhantomJS if there are no instance created. and returns it. Otherwise, returns the existing instance.
Creates an instance of PhantomJS if there are no instance created . and returns it . Otherwise returns the existing instance .