mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Use async keyword instead of Promises
This commit is contained in:
parent
acde688097
commit
43e68c519a
1 changed files with 11 additions and 16 deletions
|
@ -121,11 +121,10 @@ class MyVisualization {
|
|||
this.el = el;
|
||||
this.vis = vis;
|
||||
}
|
||||
render(visData, status) {
|
||||
return new Promise(resolve => {
|
||||
...
|
||||
resolve('done rendering');
|
||||
}),
|
||||
async render(visData, status) {
|
||||
...
|
||||
return 'done rendering';
|
||||
}
|
||||
destroy() {
|
||||
console.log('destroying');
|
||||
}
|
||||
|
@ -249,11 +248,10 @@ class MyEditorController {
|
|||
this.config = vis.type.editorConfig;
|
||||
}
|
||||
async render(visData) {
|
||||
return new Promise(resolve => {
|
||||
console.log(this.config.my);
|
||||
...
|
||||
resolve('done rendering');
|
||||
}),
|
||||
console.log(this.config.my);
|
||||
...
|
||||
return 'done rendering';
|
||||
}
|
||||
destroy() {
|
||||
console.log('destroying');
|
||||
}
|
||||
|
@ -307,12 +305,9 @@ It's up to function to decide when it wants to issue a new request or return pre
|
|||
-----------
|
||||
import { VisFactoryProvider } from 'ui/vis/vis_factory';
|
||||
|
||||
const myRequestHandler = (vis, appState, uiState, searchSource) => {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = ... parse ...
|
||||
resolve(data);
|
||||
});
|
||||
const myRequestHandler = async (vis, appState, uiState, searchSource) => {
|
||||
const data = ... parse ...
|
||||
return data;
|
||||
};
|
||||
|
||||
const MyNewVisType = (Private) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue