From 4afde96c572f7eb9378d3ee83aff57ffb2c523b3 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 11 Oct 2018 19:06:37 +0200 Subject: [PATCH] Add `once` method in Editor --- src/editor/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/editor/index.js b/src/editor/index.js index 212e2365a..a8293035d 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -629,6 +629,17 @@ module.exports = config => { return this; }, + /** + * Attach event and detach it after the first run + * @param {string} event Event name + * @param {Function} callback Callback function + * @return {this} + */ + once(event, callback) { + em.once(event, callback); + return this; + }, + /** * Detach event * @param {string} event Event name