protobuf.js
protobuf.js copied to clipboard
fix: util.global = global when this is undefined
this may be undefined in strict mode, because source code may be wrapped by some lambda function before being executed. In this case, error will occur in the following code:
util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long
|| /* istanbul ignore next */ util.global.Long
|| util.inquire("long");
Instead keeps the util.global as undefined, we assign user defined global to util.global. This can be very useful when using protobuf.js in some specifical env (for example: game engine).