Set up setImmediate for browsers.
This commit is contained in:
parent
dde33aa5a5
commit
b2be7c807f
@ -33,7 +33,9 @@ var empty = "module.exports = {};";
|
||||
// @TODO: Use path construction instead of ../..
|
||||
var brorand = "var randomBytes = require('../../src.ts/utils').randomBytes; module.exports = function(length) { return randomBytes(length); };";
|
||||
|
||||
var process = "if (!global.setImmediate) { global.setImmedaite = setTimeout; };";
|
||||
// setImmediate is installed globally by our src.browser/shims.ts, loaded from src.ts/index.ts
|
||||
var process = "module.exports = { };";
|
||||
var timers = "module.exports = { setImmediate: global.setImmediate }; ";
|
||||
|
||||
var transforms = {
|
||||
// 'ethers.js/package.json': JSON.stringify({ version: version }),
|
||||
@ -61,7 +63,7 @@ var transforms = {
|
||||
// Used by sha3 if it exists; (so make it no exist)
|
||||
// "process/.*": undef,
|
||||
"process/browser.js": process,
|
||||
"timers-browserify/main.js": empty,
|
||||
"timers-browserify/main.js": timers,
|
||||
};
|
||||
|
||||
function transformFile(path) {
|
||||
|
1
src.browser/shims.ts
Normal file
1
src.browser/shims.ts
Normal file
@ -0,0 +1 @@
|
||||
require('setimmediate');
|
@ -1,5 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
// This is empty in node, and used by browserify to inject extra goodies
|
||||
import './utils/shims';
|
||||
|
||||
import { Contract, Interface } from './contracts';
|
||||
import * as providers from './providers';
|
||||
import * as errors from './utils/errors';
|
||||
|
1
src.ts/utils/shims.ts
Normal file
1
src.ts/utils/shims.ts
Normal file
@ -0,0 +1 @@
|
||||
/* no shims for node */
|
Loading…
Reference in New Issue
Block a user