From 21727b0149732300ec29cbd29434a08c38570804 Mon Sep 17 00:00:00 2001 From: Anthony Pessy Date: Fri, 18 Nov 2016 11:56:43 +0100 Subject: [PATCH] add peekFirst/peekLast to retrieve inner flash message --- addon/services/flash-messages.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/addon/services/flash-messages.js b/addon/services/flash-messages.js index a916560e..0f117b27 100644 --- a/addon/services/flash-messages.js +++ b/addon/services/flash-messages.js @@ -50,6 +50,20 @@ export default Service.extend({ return this; }, + peekFirst() { + const queue = get(this, 'queue'); + if (queue.length > 0) { + return get(this, 'queue').objectAt(0); + } + }, + + peekLast() { + const queue = get(this, 'queue'); + if (queue.length > 0) { + return queue.objectAt(queue.length - 1); + } + }, + clearMessages() { const flashes = get(this, 'queue');