Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/mgt-element

Package Overview
Dependencies
Maintainers
2
Versions
828
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/mgt-element - npm Package Compare versions

Comparing version 2.2.0-preview.6e3772e to 2.2.0-preview.db82765

1

dist/es6/components/baseComponent.d.ts

@@ -113,2 +113,3 @@ /**

protected loadState(): Promise<void>;
protected clearState(): void;
/**

@@ -115,0 +116,0 @@ * helps facilitate creation of events across components

60

dist/es6/components/baseComponent.js

@@ -26,2 +26,3 @@ /**

import { internalProperty, LitElement } from 'lit-element';
import { ProviderState } from '../providers/IProvider';
import { Providers } from '../providers/Providers';

@@ -169,2 +170,3 @@ import { LocalizationHelper } from '../utils/LocalizationHelper';

}
clearState() { }
/**

@@ -223,23 +225,39 @@ * helps facilitate creation of events across components

}
const loadStatePromise = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
try {
this.setLoadingState(true);
this.fireCustomEvent('loadingInitiated');
yield this.loadState();
this.setLoadingState(false);
this.fireCustomEvent('loadingCompleted');
resolve();
}
catch (e) {
this.setLoadingState(false);
this.fireCustomEvent('loadingFailed');
reject(e);
}
}));
// Return the load state promise.
// If loading + forced, chain the promises.
return (this._currentLoadStatePromise =
this.isLoadingState && !!this._currentLoadStatePromise && force
? this._currentLoadStatePromise.then(() => loadStatePromise)
: loadStatePromise);
const provider = Providers.globalProvider;
if (provider.state == ProviderState.SignedOut) {
// Signed out, clear the component state
this.clearState();
return Promise.resolve();
}
else if (provider.state == ProviderState.Loading) {
// The provider state is indeterminate. Do nothing.
return Promise.resolve();
}
else {
// Signed in, load the internal component state
const loadStatePromise = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
try {
this.setLoadingState(true);
this.fireCustomEvent('loadingInitiated');
yield this.loadState();
this.setLoadingState(false);
this.fireCustomEvent('loadingCompleted');
resolve();
}
catch (e) {
// Loading failed. Clear any partially set data.
this.clearState();
this.setLoadingState(false);
this.fireCustomEvent('loadingFailed');
reject(e);
}
// Return the load state promise.
// If loading + forced, chain the promises.
// This is to account for the lack of a cancellation token concept.
return (this._currentLoadStatePromise =
this.isLoadingState && !!this._currentLoadStatePromise && force
? this._currentLoadStatePromise.then(() => loadStatePromise)
: loadStatePromise);
}));
}
});

@@ -246,0 +264,0 @@ }

{
"name": "@microsoft/mgt-element",
"version": "2.2.0-preview.6e3772e",
"version": "2.2.0-preview.db82765",
"description": "Microsoft Graph Toolkit base classes",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/microsoftgraph/microsoft-graph-toolkit",

@@ -9,2 +9,3 @@ /**

import { internalProperty, LitElement, PropertyValues } from 'lit-element';
import { ProviderState } from '../providers/IProvider';
import { Providers } from '../providers/Providers';

@@ -166,2 +167,4 @@ import { LocalizationHelper } from '../utils/LocalizationHelper';

protected clearState(): void {}
/**

@@ -228,25 +231,41 @@ * helps facilitate creation of events across components

const loadStatePromise = new Promise(async (resolve, reject) => {
try {
this.setLoadingState(true);
this.fireCustomEvent('loadingInitiated');
const provider = Providers.globalProvider;
await this.loadState();
if (provider.state == ProviderState.SignedOut) {
// Signed out, clear the component state
this.clearState();
return Promise.resolve();
} else if (provider.state == ProviderState.Loading) {
// The provider state is indeterminate. Do nothing.
return Promise.resolve();
} else {
// Signed in, load the internal component state
const loadStatePromise = new Promise(async (resolve, reject) => {
try {
this.setLoadingState(true);
this.fireCustomEvent('loadingInitiated');
this.setLoadingState(false);
this.fireCustomEvent('loadingCompleted');
resolve();
} catch (e) {
this.setLoadingState(false);
this.fireCustomEvent('loadingFailed');
reject(e);
}
});
await this.loadState();
// Return the load state promise.
// If loading + forced, chain the promises.
return (this._currentLoadStatePromise =
this.isLoadingState && !!this._currentLoadStatePromise && force
? this._currentLoadStatePromise.then(() => loadStatePromise)
: loadStatePromise);
this.setLoadingState(false);
this.fireCustomEvent('loadingCompleted');
resolve();
} catch (e) {
// Loading failed. Clear any partially set data.
this.clearState();
this.setLoadingState(false);
this.fireCustomEvent('loadingFailed');
reject(e);
}
// Return the load state promise.
// If loading + forced, chain the promises.
// This is to account for the lack of a cancellation token concept.
return (this._currentLoadStatePromise =
this.isLoadingState && !!this._currentLoadStatePromise && force
? this._currentLoadStatePromise.then(() => loadStatePromise)
: loadStatePromise);
});
}
}

@@ -253,0 +272,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc