Skip to content

Commit be65f04

Browse files
authored
fix(core): make window.__TAURI__.invoke context free, fixes #1547 (#1565)
1 parent c2e43ac commit be65f04

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

.changes/invoke-context.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Allow `window.__TAURI__.invoke` to be moved to another variable.

.github/workflows/test-core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- '.github/workflows/test-core.yml'
1111
- 'core/**'
1212
- 'examples/**'
13-
- 'cli/**'
13+
- 'tooling/**'
1414

1515
env:
1616
RUST_BACKTRACE: 1

core/tauri/scripts/core.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,12 @@ if (!String.prototype.startsWith) {
9393
};
9494

9595
window.__TAURI__.invoke = function invoke(cmd, args = {}) {
96-
var _this = this;
97-
9896
return new Promise(function (resolve, reject) {
99-
var callback = _this.transformCallback(function (r) {
97+
var callback = window.__TAURI__.transformCallback(function (r) {
10098
resolve(r);
10199
delete window[error];
102100
}, true);
103-
var error = _this.transformCallback(function (e) {
101+
var error = window.__TAURI__.transformCallback(function (e) {
104102
reject(e);
105103
delete window[callback];
106104
}, true);

tooling/cli.js/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ module.exports = {
4242
transform: {
4343
'\\.toml$': 'jest-transform-toml',
4444
'\\.(js|ts)$': 'babel-jest'
45-
}
45+
},
46+
transformIgnorePatterns: ['node_modules/(?!(is-png|imagemin|p-pipe)/)']
4647
}

0 commit comments

Comments
 (0)