Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Defaults lazyloading to true #752

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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