[Async]

Description

Link: [Async]
Author: Ke Carlton
Category: Action
Version: 8.x
License: Public Domain
Posted: Feb. 11, 2007
Updated: May. 02, 2007
More by this author...
This is a simple tag that allows any tag to be run asyncronously. It support's ctypes via the -owner property (providing the ctype is still "active"). Allows for modification of referenced variables and full logging via log_critical.

Parameters

-tag required Tag to be executed
-params array, optional Array of pairs to be passed to the tag as parameters
-owner custom type, optional Optional ctype to run the tag within
-log optional If specified results and errors will be logged to the console.
-set optional Referenced variable/local/global to be set with the result

Sample Usage

Async:	-tag	= \include_url,
	-params	= array('http://www.google.com',
			-nodata),
	-log;
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
define_tag:'Async',-Async,-privileged;

	handle_error;	//	log error if -log specified
		local_defined('log')?log_critical:tag_name' - 'error_currenterror;
	/handle_error;

	fail_if:!local_defined('tag'),			-2,	'Missing -tag param (escape with \\)';
	fail_if: local('tag')->type != 'tag', 	-2, '-tag requires a valid tag';
	fail_if: local_defined('params') &&  local('params')->type	!= 'array' , -2,	'-params requires an array';
	
	!local_defined('params')? local: 'params' 	= array;
	!local_defined('owner')	? local: 'owner' 	= null;

	local:'result' = #tag->run(-params=#params,-owner=#owner);
	
	//	log result if -log specified
	local_defined('log')	? log_critical:#tag' - '#result;		
	
	//	set result if -set @var supplied
	//	useful for triggering simultaneous async events
	local_defined('set')	? #set = @#result;

/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net