Skip to content

Commit

Permalink
Discover Browser global or explicitly require buffer module
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Jul 9, 2021
1 parent 326345b commit 4cd65bf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@

'use strict';

var Buffer;
if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
Buffer = window.Buffer;
} else {
Buffer = require('buffer').Buffer;
}

/**
* Base class for layout objects.
*
Expand Down

0 comments on commit 4cd65bf

Please sign in to comment.