'use strict';

/**
* Constructor returning an object used to represent a generic, fixed-length raw binary data buffer which can be used to create views of shared memory.
*
* @module @stdlib/array/shared-buffer
*
* @example
* var ctor = require( '@stdlib/array/shared-buffer' );
*
* var buf;
* try {
*     buf = new ctor( 10 );
*     // returns <SharedArrayBuffer>
* } catch ( err ) {
*     console.log( 'Environment does not support SharedArrayBuffers.' );
* }
*/

// MODULES //

var hasSharedArrayBufferSupport = require( '@stdlib/utils/detect-sharedarraybuffer-support' );


// MAIN //

var ctor;
if ( hasSharedArrayBufferSupport() ) {
	ctor = require( './sharedarraybuffer.js' );
} else {
	ctor = require( './polyfill.js' );
}


// EXPORTS //

module.exports = ctor;

'use strict';

/**
* Constructor returning an object used to represent a generic, fixed-length raw binary data buffer which can be used to create views of shared memory.
*
* @module @stdlib/array/shared-buffer
*
* @example
* var ctor = require( '@stdlib/array/shared-buffer' );
*
* var buf;
* try {
*     buf = new ctor( 10 );
*     // returns <SharedArrayBuffer>
* } catch ( err ) {
*     console.log( 'Environment does not support SharedArrayBuffers.' );
* }
*/

// MODULES //

var hasSharedArrayBufferSupport = require( '@stdlib/utils/detect-sharedarraybuffer-support' );
var builtin = require( './sharedarraybuffer.js' );
var polyfill = require( './polyfill.js' );


// MAIN //

var ctor;
if ( hasSharedArrayBufferSupport() ) {
	ctor = builtin;
} else {
	ctor = polyfill;
}


// EXPORTS //

module.exports = ctor;

Refactor to avoid dynamic module resolution
Refactor to avoid dynamic module resolution
