template-replacement 3.5.0 → 3.5.1

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.
Files changed (2) hide show
  1. package/README.md +8 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,7 @@ const replaceInstance = tr()
34
34
  需要同时替换大量文件时使用
35
35
  ``` javascript
36
36
  import tr from 'template-replacement'
37
- const worker = 4 //线程数量,建议<=CPU核心数
37
+ const worker = navigator.hardwareConcurrency ?? 4 //线程数量,建议<=CPU核心数
38
38
  const replaceInstance = tr(worker)
39
39
  ```
40
40
  3、模板替换并校验签名:
@@ -56,7 +56,7 @@ const replaceInstance = tr(0, getSignature)
56
56
  4、多线程模板替换并校验签名:
57
57
  ``` javascript
58
58
  import tr from 'template-replacement'
59
- const worker = 4 //线程数量,建议<=CPU核心数
59
+ const worker = navigator.hardwareConcurrency ?? 4 //线程数量,建议<=CPU核心数
60
60
  const replaceInstance = tr(worker, getSignature)
61
61
  ```
62
62
 
@@ -179,6 +179,12 @@ media.setPxExtent(width: number, height: number)
179
179
  * 设置图片的宽高(厘米)
180
180
  */
181
181
  media.setCmExtent(width: number, height: number)
182
+
183
+ /**
184
+ * 等待媒体数据初始化完成
185
+ * 数据初始化完成后才能使用媒体数据进行替换(重要!!!)
186
+ */
187
+ await media.awaitInit();
182
188
  ```
183
189
 
184
190
  2、文件加密,需要防止被第三方获取到模板文件的场景可以使用(配合class Temp中的isDecode属性进行解码使用)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "template-replacement",
3
3
  "description": "模板文件替换",
4
- "version": "3.5.0",
4
+ "version": "3.5.1",
5
5
  "author": "fushiliang <994301536@qq.com>",
6
6
  "type": "module",
7
7
  "main": "index.ts",