Skip to content

Commit

Permalink
v1.12.7.0: Enforce options.chain==true for type!=OVERRIDE
Browse files Browse the repository at this point in the history
  • Loading branch information
ruipin committed Jun 21, 2022
1 parent e72ebb5 commit 50c9fc9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.12.7.0 (2022-06-21)

- Enforce `options.chain == true` when registering non-OVERRIDE wrappers.

# 1.12.6.0 (2022-06-15)

- Add support for reading core compatibility versions for packages using the new Foundry VTT v10 manifest format.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ To register a wrapper function, you should call the method `libWrapper.register(
* @param {Object} options [Optional] Additional options to libWrapper.
*
* @param {boolean} options.chain [Optional] If 'true', the first parameter to 'fn' will be a function object that can be called to continue the chain.
* This parameter must be 'true' when registering non-OVERRIDE wrappers.
* Default is 'false' if type=='OVERRIDE', otherwise 'true'.
* First introduced in v1.3.6.0.
*
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "lib-wrapper",
"title": "libWrapper",
"description": "Library for wrapping core Foundry VTT methods, meant to improve compatibility between packages that wrap the same methods.",
"version": "1.12.6.0",
"version": "1.12.7.0",
"author": "Rui Pinheiro",
"esmodules": ["src/index.js"],
"styles": ["dist/lib-wrapper.css"],
Expand Down
3 changes: 3 additions & 0 deletions src/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ export class libWrapper {
* @param {Object} options [Optional] Additional options to libWrapper.
*
* @param {boolean} options.chain [Optional] If 'true', the first parameter to 'fn' will be a function object that can be called to continue the chain.
* This parameter must be 'true' when registering non-OVERRIDE wrappers.
* Default is 'false' if type=='OVERRIDE', otherwise 'true'.
* First introduced in v1.3.6.0.
*
Expand Down Expand Up @@ -487,6 +488,8 @@ export class libWrapper {
const chain = options?.chain ?? (type.value < WRAPPER_TYPES.OVERRIDE.value);
if(typeof chain !== 'boolean')
throw new ERRORS.package(`Parameter 'options.chain' must be a boolean.`, package_info);
if(!chain && type.value < WRAPPER_TYPES.OVERRIDE.value)
throw new ERRORS.package(`Parameter 'options.chain' must be 'true' for non-OVERRIDE wrappers.`, package_info);

if(IS_UNITTEST && FORCE_FAST_MODE)
options.perf_mode = 'FAST';
Expand Down

0 comments on commit 50c9fc9

Please sign in to comment.