Development

dgDojoPlugin/DojoJavascript (diff)

You must first sign up to be able to contribute.

Changes between Version 2 and Version 3 of dgDojoPlugin/DojoJavascript

Show
Ignore:
Author:
Dean.Glazeski (IP: 68.225.171.15)
Timestamp:
07/27/08 23:05:54 (9 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • dgDojoPlugin/DojoJavascript

    v2 v3  
    135135 
    136136Whenever the JSVar is destroyed, it automatically unregisters its variable name so that it can be used again.  So, when you call a function but don't capture its return variable, the variable name won't get used up. 
     137 
     138== Javascript Function == 
     139 
     140The main point of this class is to allow a user to create Javascript functions that can make it through the PHP to JS converter function without being put in quotes.  It also acts like a mini Javascript manager as it maintains script entries, but not variable names. 
     141 
     142=== Creating a Javascript Function === 
     143 
     144The creation of a function allows you to specify the arguments and the script to initially add to it.  For example, 
     145 
     146{{{ 
     147#!php 
     148<?php 
     149// create a function that just alerts 
     150$func = new JSFunction(array(), 'alert("FOOOOOOOOL!")'); 
     151$var = new JSVar(); 
     152 
     153// JS: unique.onClick = function() { alert("FOOOOOOOOL!"); } 
     154$var->onClick = $func; 
     155 
     156$func = new JSFunction(array('foo', 'bar'), 'alert("I hate " + foo + " and " + bar "!!!")' ); 
     157 
     158// JS: unique.onClick = function(foo, bar) { alert("I hate " + foo + " and " + bar "!!!"); } 
     159$var->onClick = $func 
     160?> 
     161}}} 
     162 
     163== Suggestions == 
     164 
     165This is where I am at with this library.  If you have any suggestions, let Dean Glazeski know.