PHP Classes

File: jsFlush-example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Malte Dreyer  >  jsFlush  >  jsFlush-example.php  >  Download  
File: jsFlush-example.php
Role: Example script
Content type: text/plain
Description: Examples for the jsFlush-class
Class: jsFlush
Output JavaScript and show PHP errors on the pages
Author: By
Last change: Changed listing priority
Date: 2 years ago
Size: 1,282 bytes


Class file image Download
     * @package jsFlush
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

$js = new jsFlush();

// test standard exec
$js->_js_exec('document.title = "Example: jsFlush";');

// set error handlers so that all E_USER_ types of errors will only be shown in the console

// trigger different types of errors
trigger_error('notice', E_USER_NOTICE);
trigger_error('warning', E_USER_WARNING);
// if set to true, the script execution stops at that point (through the use of exit)
$js->error_abort = false;
trigger_error('error', E_USER_ERROR);

// test a normal js function
// has to be false for variables, btw
$js->auto_add_quotes = true;
// with auto_add_quotes set to true it's easier to write strings but JSON objects etc. will also end up as such.

// test exception handler
            throw new
Exception('message', 9412);
// script execution stops after the exception. This is done automatically and I don't know whether it can be deactivated.