Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit b1e5970

Browse files
JiaLiPassionmhevery
authored andcommitted
feat(cordova): fix #868, patch cordova FileReader (#879)
1 parent fcf187c commit b1e5970

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: lib/extra/cordova.ts

+17
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,21 @@ Zone.__load_patch('cordova', (global: any, Zone: ZoneType, api: _ZonePrivate) =>
2121
return nativeExec.apply(self, args);
2222
});
2323
}
24+
});
25+
26+
Zone.__load_patch('cordova.FileReader', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
27+
if (global.cordova && typeof global['FileReader'] !== 'undefined') {
28+
document.addEventListener('deviceReady', () => {
29+
const FileReader = global['FileReader'];
30+
['abort', 'error', 'load', 'loadstart', 'loadend', 'progress'].forEach(prop => {
31+
const eventNameSymbol = Zone.__symbol__('ON_PROPERTY' + prop);
32+
Object.defineProperty(FileReader.prototype, eventNameSymbol, {
33+
configurable: true,
34+
get: function() {
35+
return this._realReader && this._realReader[eventNameSymbol];
36+
}
37+
});
38+
});
39+
});
40+
}
2441
});

0 commit comments

Comments
 (0)