From b8178e92b4c50c4bb616362078bc3d03d2dcf275 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Thu, 7 Dec 2017 15:47:42 +0800 Subject: [PATCH] Add deprecation warning for onrendered (Fix #1290) --- src/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.js b/src/index.js index 0279c09..01e016e 100644 --- a/src/index.js +++ b/src/index.js @@ -39,6 +39,12 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => { const config = conf || {}; const logger = new Logger(); + if (__DEV__ && typeof config.onrendered === 'function') { + logger.error( + `onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value` + ); + } + const ownerDocument = element.ownerDocument; if (!ownerDocument) { return Promise.reject(`Provided element is not within a Document`);