From 4d9d7d51900ba9fc5690e4ac11c18f524eba6969 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 6 Mar 2013 15:05:23 +0100 Subject: [PATCH] ClientJS: render()-Funktion zum noch besseren Chaining --- SL/ClientJS.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SL/ClientJS.pm b/SL/ClientJS.pm index 47f8a225b..4a0080fc5 100644 --- a/SL/ClientJS.pm +++ b/SL/ClientJS.pm @@ -98,6 +98,11 @@ sub to_array { return $self->_actions; } +sub render { + my ($self, $controller) = @_; + return $controller->render(\$self->to_json, { type => 'json' }); +} + 1; __END__ @@ -198,6 +203,13 @@ are the function parameters. Returns the actions gathered so far as a JSON string ready to be sent to the client. +=item C + +Renders C<$self> via the controller. Useful for chaining. Equivalent +to the following: + + $controller->render(\$self->to_json, { type => 'json' }); + =back =head1 FUNCTIONS EVALUATED ON THE CLIENT SIDE -- 2.20.1