File tree Expand file tree Collapse file tree 5 files changed +9
-6
lines changed Expand file tree Collapse file tree 5 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export class PluginInstance implements IContainerPlugin {
10
10
}
11
11
12
12
async init ( ) : Promise < void > {
13
- // add your plugin initialization here
13
+ // add your plugin initialization here, replace the empty promise
14
+ return await Promise . resolve ( ) ;
14
15
}
15
16
}
Original file line number Diff line number Diff line change @@ -20,14 +20,16 @@ class Plugin implements IPlugin {
20
20
21
21
loadOptions ( _options : Options , _source ?: ISourceOptions ) : void {
22
22
if ( ! this . needsPlugin ( ) ) {
23
+ // ignore plugin options when not needed
24
+
23
25
return ;
24
26
}
25
27
26
28
// Load your options here
27
29
}
28
30
29
31
needsPlugin ( _options ?: ISourceOptions ) : boolean {
30
- return true ; // add your condition here
32
+ return true ; // add your condition here, replace true with condition if needed
31
33
}
32
34
}
33
35
Original file line number Diff line number Diff line change 1
1
import { loadTemplatePreset } from "." ;
2
2
import { tsParticles } from "@tsparticles/engine" ;
3
3
4
- loadTemplatePreset ( tsParticles ) ;
4
+ void loadTemplatePreset ( tsParticles ) ;
5
5
6
6
export { loadTemplatePreset , tsParticles } ;
Original file line number Diff line number Diff line change @@ -5,9 +5,9 @@ import { options } from "./options";
5
5
*
6
6
* @param engine - the engine instance to load the preset into
7
7
*/
8
- export function loadTemplatePreset ( engine : Engine ) : void {
8
+ export async function loadTemplatePreset ( engine : Engine ) : Promise < void > {
9
9
// TODO: additional modules must be loaded here
10
10
11
11
// Adds the preset to the engine, with the given options
12
- engine . addPreset ( "#template#" , options ) ;
12
+ await engine . addPreset ( "#template#" , options ) ;
13
13
}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { createPresetTemplate } from "../src/create/preset/create-preset";
4
4
import path from "path" ;
5
5
import fs from "fs-extra" ;
6
6
7
- describe ( "create-plugin " , async ( ) => {
7
+ describe ( "create-preset " , async ( ) => {
8
8
it ( "should have created the preset project" , async ( ) => {
9
9
const destDir = path . resolve ( path . join ( __dirname , "tmp-files" , "foo-preset" ) ) ;
10
10
You can’t perform that action at this time.
0 commit comments