@cesdk/engine 1.44.0-rc.3 → 1.45.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -42,8 +42,41 @@ export declare interface Asset {
42
42
  export declare class AssetAPI {
43
43
  #private;
44
44
 
45
-
46
-
45
+ /**
46
+ * Register a middleware that is called before applying an asset to the scene.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * engine.asset.unstable_registerApplyAssetMiddleware(async (sourceId, assetResult, apply) => {
51
+ * // do something before applying the asset
52
+ * // You still have the choice to call apply or skip it
53
+ * const blockId = await apply(sourceId, assetResult);
54
+ * // do something after applying the asset
55
+ * return blockId;
56
+ * })
57
+ * ```
58
+ *
59
+ * @param middleware - The middleware function that is called before applying the asset.
60
+ * @returns A function that can be used to remove the middleware.
61
+ */
62
+ unstable_registerApplyAssetMiddleware(middleware: (sourceId: string, assetResult: AssetResult, apply: AssetAPI['apply']) => Promise<DesignBlockId | undefined>): VoidFunction;
63
+ /**
64
+ * Register a middleware that is called before applying an asset to a block.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * engine.asset.unstable_registerApplyAssetToBlockMiddleware(async (sourceId, assetResult, block, applyToBlock) => {
69
+ * // do something before applying the asset
70
+ * // You still have the choice to call applyToBlock or skip it
71
+ * await applyToBlock(sourceId, assetResult, block);
72
+ * // do something after applying the asset
73
+ * })
74
+ * ```
75
+ *
76
+ * @param middleware - The middleware function that is called before applying the asset.
77
+ * @returns A function that can be used to remove the middleware.
78
+ */
79
+ unstable_registerApplyAssetToBlockMiddleware(middleware: (sourceId: string, assetResult: AssetResult, block: DesignBlockId, applyToBlock: AssetAPI['applyToBlock']) => Promise<void>): VoidFunction;
47
80
  /**
48
81
  * Adds a custom asset source. Its ID has to be unique.
49
82
  * @param source - The asset source.
@@ -2825,6 +2858,7 @@ export declare class BlockAPI {
2825
2858
  getVolume(id: DesignBlockId): number;
2826
2859
  /**
2827
2860
  * Begins loading the required audio and video resource for the given video fill or audio block.
2861
+ * If the resource had been loaded earlier and resulted in an error, it will be reloaded.
2828
2862
  * @param id - The video fill or audio block whose resource should be loaded.
2829
2863
  * @returns A Promise that resolves once the resource has finished loading.
2830
2864
  */
@@ -2988,6 +3022,7 @@ export declare class BlockAPI {
2988
3022
  onStateChanged: (ids: DesignBlockId[], callback: (ids: DesignBlockId[]) => void) => (() => void);
2989
3023
  /**
2990
3024
  * Begins loading the resources of the given blocks and their children.
3025
+ * If the resource had been loaded earlier and resulted in an error, it will be reloaded.
2991
3026
  * This function is useful for preloading resources before they are needed.
2992
3027
  * Warning: For elements with a source set, all elements in the source set will be loaded.
2993
3028
  * @param ids - The blocks whose resources should be loaded. The given blocks don't require to have resources and
@@ -3655,7 +3690,7 @@ export declare class EditorAPI {
3655
3690
  * Sets a custom URI resolver.
3656
3691
  * This function can be called more than once. Subsequent calls will overwrite previous calls.
3657
3692
  * To remove a previously set resolver, pass the value `null`.
3658
- * The given function must return an absolute path with a scheme.
3693
+ * The given function must return an absolute path with a scheme. The input is allowed to be invalid URI, e.g., due to placeholders.
3659
3694
  * @param resolver - Custom resolution function. The resolution function
3660
3695
  * should not reference variables outside of its scope.
3661
3696
  * It receives the default URI resolver as its second argument