<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="js" module="max" category="Languages">
	<digest>
		Execute Javascript
	</digest>
	<description>
		Exposes the Javascript language and some Max specific extensions. The <o>js</o> object can be instantiated with a javascript filename or with numerical arguments to specify the number of outlets and inlets respectively. The default number of outlets and inlets are both 1.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			Languages
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				js: Inlet 0
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				js: Inlet 1
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				js: Outlet 0
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="filename" optional="1" type="symbol">
			<digest>
				Javascript source file name
			</digest>
			<description>
				Specifies the name of a text file to be used as the Javascript source. If no argument is specified, it will not initially have any Javascript associated with it. You can still open a text window and edit and save the Javascript source, but unless you recreate the object with the saved source filename as an argument, the file will not be used when a patch containing the <o>js</o> object is loaded.
			</description>
		</objarg>
		<objarg name="inlets-outlets" optional="1" type="list">
			<digest>
				Number of inlets and/or outlets
			</digest>
			<description>
				If no filename is present as an argument, the number of inlets and outlets is specified. If one int argument is present, the number of desired outlets is specified. If two int arguments are present, the first number specifies the number of outlets and the second number specifies the number of inlets.
			</description>
		</objarg>
		<objarg name="jsarguments" optional="1" type="list">
			<digest>
				Script arguments
			</digest>
			<description>
				Following the optional filename or number of outlets and inlets, any symbols or numbers can be entered that will be assigned to the Javascript variable jsarguments. jsarguments[0] is the filename entered, and jsarguments[1] is the first typed-in argument following the filename. The Javascript expression jsarguments.length will be one more than the number of typed-in arguments
			</description>
		</objarg>
	</objarglist>
	<!--parameter-->
	<parameter />
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Send a bang to the Javascript
			</digest>
			<description>
				Invokes the function named bang if defined.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="user-defined" optional="0" type="int" />
			</arglist>
			<digest>
				Call the msg_int function
			</digest>
			<description>
				Invokes the function named msg_int if defined.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="user-defined" optional="0" type="float" />
			</arglist>
			<digest>
				Call the msg_float function
			</digest>
			<description>
				Invokes the function named msg_float if defined.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="user-defined" optional="0" type="list" />
			</arglist>
			<digest>
				Evaluate and call a function
			</digest>
			<description>
				Performs the same as <m>anything</m>.
			</description>
		</method>
		<method name="anything">
			<arglist>
				<arg name="user-defined" optional="0" type="list" />
			</arglist>
			<digest>
				Evaluate and call a function
			</digest>
			<description>
				Invokes the function with the message name, assigning the message arguments to the arguments to the function. For example, if the object has a function named xyz defined, the message <m>xyz 1 2 3</m> would invoke the xyz function with arguments 1 2 and 3.
			</description>
		</method>
		<method name="autowatch">
			<arglist>
				<arg name="flag" optional="0" type="int" />
			</arglist>
			<digest>
				Watch for changes in the source file
			</digest>
			<description>
				The message <m>autowatch</m>, followed by a 1, turns on file watching for the Javascript source file. When file watching is on, the file is recompiled automatically when it is modified. This allows you to use an external editor for your Javascript file. When you save the file, the <o>js</o> object will notice. <m>autowatch 0</m> turns off file watching.
			</description>
		</method>
		<method name="compile">
			<arglist>
				<arg name="filename" optional="0" type="symbol" />
			</arglist>
			<digest>
				Recompiles the current file
			</digest>
			<description>
				Recompiles the current file.
			</description>
		</method>
		<method name="delprop">
			<arglist>
				<arg name="propertyname" optional="0" type="symbol" />
			</arglist>
			<digest>
				Delete a named property
			</digest>
			<description>
				The word <m>delprop</m>, followed by a name, deletes the named property.
			</description>
		</method>
		<method name="editfontsize">
			<arglist>
				<arg name="font-size" optional="0" type="int" />
			</arglist>
			<digest>
				Change the editing window's font size
			</digest>
			<description>
				Changes the font-size of the text used in the editing window which contains the object's Javascript source file.
			</description>
		</method>
		<method name="getprop">
			<arglist>
				<arg name="property" optional="0" type="symbol" />
			</arglist>
			<digest>
				Report a property's value
			</digest>
			<description>
				The word <m>getprop</m>, followed by a name, outputs the value of the property name stored in the object out the left outlet.
			</description>
		</method>
		<method name="loadbang">
			<arglist />
			<digest>
				Call the loadbang function
			</digest>
			<description>
				Invokes the function named loadbang if defined. This message is sent when the file is loaded.
			</description>
		</method>
		<method name="open">
			<arglist />
			<digest>
				Open a window for Javascript editing
			</digest>
			<description>
				Opens the text window where the object's Javascript source file can be edited.
			</description>
		</method>
		<method name="setprop">
			<arglist>
				<arg name="property" optional="0" type="symbol" />
				<arg name="values" optional="0" type="list" />
			</arglist>
			<digest>
				Set a named property's value
			</digest>
			<description>
				The word <m>setprop</m>, followed by name and one or more names or numbers, sets the named property to what follows the name. For example, after sending setprop <m>xyz 1 2 3</m> to a <o>js</o> object. the xyz property would have a value of the list 1 2 3.
			</description>
		</method>
		<method name="statemessage">
			<arglist>
				<arg name="messages" optional="0" type="list" />
			</arglist>
			<digest>
				Test passed messages
			</digest>
			<description>
				Allows for the testing of messages passed to functions within the Javascript source file.
			</description>
		</method>
		<method name="wclose">
			<arglist />
			<digest>
				Close the editing window
			</digest>
			<description>
				Closes the text window where the object's Javascript source file is edited.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<attributelist>
		<attribute name="parameter_enable" get="1" set="1" type="int" size="1">
			<digest>
				Enable parameter mode handling
			</digest>
			<description>
				Enables use of this object with <link type="vignette" module="core" name="live_parameters">Max for Live Parameters</link>.
			</description>
			<attributelist>
				<attribute name="category" get="1" set="1" type="atom" size="1" value="Parameter" />
				<attribute name="label" get="1" set="1" type="symbol" size="1" value="Parameter Mode Enable" />
				<attribute name="order" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="save" get="1" set="1" type="int" size="1" value="1" />
				<attribute name="style" get="1" set="1" type="symbol" size="1" value="onoff" />
			</attributelist>
		</attribute>
	</attributelist>
	<!--EXAMPLE-->
	<examplelist>
		<example img="js.png" caption="Two js objects instantiated with different arguments the Javascript code creates the objects with different numbers of outlets based on the arguments" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="jstrigger" />
		<seealso name="jsui" />
		<seealso name="mxj" />
		<seealso module="max" name="javascriptchapter01" type="tutorial" />
		<seealso module="max" name="javascriptchapter02" type="tutorial" />
		<seealso module="max" name="javascriptchapter03" type="tutorial" />
		<seealso module="jit" name="jitterchapter45" type="tutorial" />
		<seealso module="jit" name="jitterchapter46" type="tutorial" />
		<seealso module="jit" name="jitterchapter47" type="tutorial" />
	</seealsolist>
	<discussion>
		Note that this implementation does not include the traditional web browser specific extensions that are often associated with Javascript.
	</discussion>
	<misc name="methodnote">
		All messages listed below can be sent to any inlet of the <o>js</o> object. The Javascript inlet property reveals the inlet that received the message that invoked the currently running script.
	</misc>
	<misc name="Output">
		<entry name="anything">
			<description>
				Numbers, lists, or symbols are sent out the <o>js</o> object's outlets when the Javascript code executing within the <o>js</o> object invokes the outlet function.
			</description>
		</entry>
	</misc>
</c74object>
