thriftrw / thriftrw-node

A thrift binary encoding library using bufrw
MIT License
57 stars 25 forks source link

Polish async loader #178

Closed kriskowal closed 4 years ago

kriskowal commented 4 years ago

This change inlines the _init method into the Thrift constructor and pivots the async vs sync behavior from Thrift.load into the Thrift constructor, using a callback option which also replaces the signal asyncReadFile used previously to switch off the synchronous constructor behaviors. V8 infers the final hidden classe produced by a constructor function from the properties created within the constructor function so inlining bypasses the creation of intermediate hidden classes.

Previous changes inferred that this project uses underscore prefixes for private methods, based on the precedent of compile/_compile. This change corrects that misunderstanding by renaming some methods.

kriskowal commented 4 years ago

cc @dbousque