瀏覽代碼

Changed usage of async/await to promises in code sample.

Oskar Wróbel 6 年之前
父節點
當前提交
af52a945a7
共有 1 個文件被更改,包括 21 次插入17 次删除
  1. 21 17
      packages/ckeditor5-core/src/context.js

+ 21 - 17
packages/ckeditor5-core/src/context.js

@@ -234,7 +234,7 @@ export default class Context {
 	 *		const commonConfig = { ... }; // Configuration for all the plugins and editors.
 	 *		const editorPlugins = [ ... ]; // Regular `Plugin`s here.
 	 *
-	 *		const context = await Context.create( {
+	 *		Context.create( {
 	 *			// Only `ContextPlugin`s here.
 	 *			plugins: [ ... ],
 	 *
@@ -249,24 +249,28 @@ export default class Context {
 	 *			toolbar: { ... },
 	 *			image: { ... },
 	 *			...
-	 *		} );
+	 *		} ).then( context => {
+	 *			const promises = [];
+	 *
+	 *			promises.push( ClassicEditor.create(
+	 *				document.getElementById( 'editor1' ),
+	 *				{
+	 *					editorPlugins,
+	 *					context
+	 *				}
+	 *			) );
 	 *
-	 *		const editor1 = await ClassicEditor.create(
-	 *			document.getElementById( 'editor1' ),
-	 *			{
-	 *				editorPlugins,
-	 *				context
-	 *			}
-	 *		);
+	 *			promises.push( ClassicEditor.create(
+	 *				document.getElementById( 'editor2' ),
+	 *				{
+	 *					editorPlugins,
+	 *					context,
+	 *					toolbar: { ... } // You can overwrite context's configuration.
+	 *				}
+	 *			) );
 	 *
-	 *		const editor2 = await ClassicEditor.create(
-	 *			document.getElementById( 'editor2' ),
-	 *			{
-	 *				editorPlugins,
-	 *				context,
-	 *				toolbar: { ... } // You can overwrite context's configuration.
-	 *			}
-	 *		);
+	 *			return Promise.all( promises );
+	 *		} );
 	 *
 	 * @param {Object} [config] The context config.
 	 * @returns {Promise} A promise resolved once the context is ready. The promise resolves with the created context instance.