Skip to content

Commit

Permalink
chore: Defaults lazyloading to true (#752)
Browse files Browse the repository at this point in the history
* [DI-2059] default lazyloading to true
  • Loading branch information
claudiachua authored May 19, 2022
1 parent be408e9 commit c272b7d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ If your environment requires SSL decryption, you can set the path to CA bundle i

### Lazy Loading

`twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is disabled by default. To enable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `true`:
`twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is enabled by default. To disable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `false`:
```javascript
var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console

const client = require('twilio')(accountSid, authToken, {
lazyLoading: true
lazyLoading: false
});
```

Expand Down
2 changes: 1 addition & 1 deletion lib/rest/Twilio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ declare namespace Twilio {
* @property edge - Twilio edge to use. Defaults to none
* @property env - The environment object. Defaults to process.env
* @property httpClient - The client used for http requests. Defaults to RequestClient
* @property lazyLoading - Enable lazy loading, loading time will decrease if enabled
* @property lazyLoading - Enable lazy loading, loading time will decrease if enabled. Defaults to true
* @property logLevel - Debug logs will be shown. Defaults to none
* @property region - Twilio region to use. Defaults to us1 if edge defined
* @property userAgentExtensions - Additions to the user agent string
Expand Down
6 changes: 3 additions & 3 deletions lib/rest/Twilio.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ var RestException = require('../base/RestException'); /* jshint ignore:line */
* @param {string} [opts.region] -
* Twilio region to use. Defaults to us1 if edge defined
* @param {boolean} [opts.lazyLoading] -
* Enable lazy loading, loading time will decrease if enabled
* Enable lazy loading, loading time will decrease if enabled. Defaults to true
* @param {string} [opts.logLevel] - Debug logs will be shown. Defaults to none
* @param {string[]} [opts.userAgentExtensions] -
* Additions to the user agent string
Expand All @@ -127,7 +127,7 @@ function Twilio(username, password, opts) {
this.password = password || env.TWILIO_AUTH_TOKEN;
this.accountSid = opts.accountSid || this.username;
this._httpClient = opts.httpClient;
if (!opts.lazyLoading) {
if (opts.lazyLoading == false) {
this._httpClient = this.httpClient;
}
this.edge = opts.edge || env.TWILIO_EDGE;
Expand Down Expand Up @@ -181,7 +181,7 @@ function Twilio(username, password, opts) {
this._supersim = undefined;
this._bulkexports = undefined;

if (!opts.lazyLoading) {
if (opts.lazyLoading == false) {
this.accounts;
this.api;
this.autopilot;
Expand Down

0 comments on commit c272b7d

Please sign in to comment.