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

Commit

Permalink
feat(cordova): fix #868, patch cordova FileReader (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion authored and mhevery committed Aug 23, 2017
1 parent fcf187c commit b1e5970
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/extra/cordova.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,21 @@ Zone.__load_patch('cordova', (global: any, Zone: ZoneType, api: _ZonePrivate) =>
return nativeExec.apply(self, args);
});
}
});

Zone.__load_patch('cordova.FileReader', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
if (global.cordova && typeof global['FileReader'] !== 'undefined') {
document.addEventListener('deviceReady', () => {
const FileReader = global['FileReader'];
['abort', 'error', 'load', 'loadstart', 'loadend', 'progress'].forEach(prop => {
const eventNameSymbol = Zone.__symbol__('ON_PROPERTY' + prop);
Object.defineProperty(FileReader.prototype, eventNameSymbol, {
configurable: true,
get: function() {
return this._realReader && this._realReader[eventNameSymbol];
}
});
});
});
}
});

0 comments on commit b1e5970

Please sign in to comment.