{"size": 1070, "ext": "js", "max_stars_repo_path": "async-proxy.js/scripts/backup/transferablesfrompromise.js", "max_stars_repo_name": "MaMazav/MaMazav.github.io", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "async-proxy.js/scripts/backup/transferablesfrompromise.js", "max_issues_repo_name": "MaMazav/MaMazav.github.io", "max_issues_repo_issues_event_min_datetime": "2016-08-06T23:16:22.000Z", "max_issues_repo_issues_event_max_datetime": "2016-08-08T00:01:44.000Z", "max_forks_repo_path": "async-proxy.js/scripts/backup/transferablesfrompromise.js", "max_forks_repo_name": "MaMazav/MaMazav.github.io", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 41.1538461538, "max_line_length": 112, "alphanum_fraction": 0.6570093458}
'use strict';

var TransferablesFromPromise = (function TransferablesFromPromiseClosure() {
    function TransferablesFromPromise() {
        var scriptsToImport = [asyncProxy.AsyncProxyMaster.getEntryUrl() + '/scripts/callee.js'];
        this._workerHelper = new asyncProxy.AsyncProxyMaster(scriptsToImport, 'Callee');
    }
    
    TransferablesFromPromise.prototype.passArrayBuffer = function passArrayBuffer(uint8Array) {
        var args = [uint8Array];
        var pathToTransferables = ['someProperty', 'buffer']; // Take promiseResult.someProperty.buffer as ports
        var portPaths = [pathToTransferables];
        
        var promise = this._workerHelper.callFunction('passArrayBuffer', args, {
            isReturnPromise: true,
            pathsToTransferablesInPromiseResult: portPaths });
        
        promise.then(function(result) {
            if (result.someProperty[0] === uint8Array[0]) {
                console.log('result is accessible in UI, what a fun!');
            }
        });
    };
    
    return TransferablesFromPromise;
})();