mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
refactor(): deprecate web component controllers (#19109)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, ComponentInterface, Method } from '@stencil/core';
|
||||
import { Build, Component, ComponentInterface, Method } from '@stencil/core';
|
||||
|
||||
import { LoadingOptions, OverlayController } from '../../interface';
|
||||
import { createOverlay, dismissOverlay, getOverlay } from '../../utils/overlays';
|
||||
@@ -8,6 +8,14 @@ import { createOverlay, dismissOverlay, getOverlay } from '../../utils/overlays'
|
||||
})
|
||||
export class LoadingController implements ComponentInterface, OverlayController {
|
||||
|
||||
constructor() {
|
||||
if (Build.isDev) {
|
||||
console.warn(`[DEPRECATED][ion-loading-controller] Use the loadingController export from @ionic/core:
|
||||
import { loadingController } from '@ionic/core';
|
||||
const modal = await loadingController.create({...});`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a loading overlay with loading options.
|
||||
*
|
||||
|
||||
@@ -8,25 +8,6 @@ Loading controllers programmatically control the loading component. Loadings can
|
||||
<!-- Auto Generated Below -->
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Javascript
|
||||
|
||||
```javascript
|
||||
async function presentLoading() {
|
||||
const loadingController = document.querySelector('ion-loading-controller');
|
||||
|
||||
const loadingElement = await loadingController.create({
|
||||
message: 'Please wait...',
|
||||
spinner: 'crescent',
|
||||
duration: 2000
|
||||
});
|
||||
return await loadingElement.present();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### `create(options?: LoadingOptions | undefined) => Promise<HTMLIonLoadingElement>`
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
```javascript
|
||||
async function presentLoading() {
|
||||
const loadingController = document.querySelector('ion-loading-controller');
|
||||
|
||||
const loadingElement = await loadingController.create({
|
||||
message: 'Please wait...',
|
||||
spinner: 'crescent',
|
||||
duration: 2000
|
||||
});
|
||||
return await loadingElement.present();
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user