PHP Classes

File: tests/src/response/TestJs.php

Recommend this page to a friend!
  Packages of Thierry Feuzeu   Jaxon   tests/src/response/TestJs.php   Download  
File: tests/src/response/TestJs.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon
Call PHP classes from JavaScript using AJAX
Author: By
Last change:
Date: 1 year ago
Size: 1,368 bytes
 

Contents

Class file image Download
<?php

use Jaxon\App\FuncComponent;

class TestJs extends FuncComponent
{
    public function redirect()
    {
        $this->response->redirect('http://example.test/path', 50);
        $this->response->redirect('http://example.test/path');
    }

    public function confirm()
    {
        $this->response->confirm(function($resp) {
            $resp->debug('This is the first debug message!!');
            $resp->debug('This is the second debug message!!');
        }, 'Confirm?');
    }

    public function alert()
    {
        $this->response->alert('This is an alert!!');
    }

    public function debug()
    {
        $this->response->debug('This is a debug message!!');
    }

    public function call()
    {
        $this->response->call('console.debug', 'A debug message');
    }

    public function setEvent()
    {
        $this->response->setEventHandler('div', 'click', jo('console')->debug("A debug message"));
    }

    public function onClick()
    {
        $this->response->onClick('div', jo('console')->debug("A debug message"));
    }

    public function addHandler()
    {
        $this->response->addHandler('div', 'click', 'jsFunc');
    }

    public function removeHandler()
    {
        $this->response->removeHandler('div', 'click', 'jsFunc');
    }

    public function sleep()
    {
        $this->response->sleep(100);
    }
}