PHP Classes

File: examples/case-studies/ui/ui_event_binding/ui_event_binding-GR.md

Recommend this page to a friend!
  Packages of Christos Drogidis   Ascoos OS   examples/case-studies/ui/ui_event_binding/ui_event_binding-GR.md   Download  
File: examples/case-studies/ui/ui_event_binding/ui_event_binding-GR.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Ascoos OS
A PHP Web 5.0 Kernel for decentralized web and IoT
Author: By
Last change: Update of examples/case-studies/ui/ui_event_binding/ui_event_binding-GR.md
Date: 9 months ago
Size: 3,646 bytes
 

Contents

Class file image Download

???????? UI ????????? ?? TEventHandler

???? ? ?????? ?????????? ??????? ??? ?? Ascoos OS ?????? ?? ????????? ???????? ??? ?? UI (?.?. onClick) ?? ?????? ???? server ???? ??? ?????? TEventHandler. ??????????? ?????????, ???????? callbacks ??? ??????? ?? BootLib, Ajax ? DSL macros.

??????

?? ?????????? ???????????? ??? ???????? ????? ??? Ascoos OS: - TEventHandler: ??????????? ??? ??????????? ????????, ?????????? ????????????? ??? ??????? ?????? ???? callbacks ? functions.

????

? ?????? ??????????? ?? ??? ?????? PHP: - ui_event_binding.php: ???????????? ?????????? ?????????, ????????????, ????????? ??? ???????? ???????.

??????????????

  1. ??????????? ??? Ascoos OS (????? ??????????).
  2. ?????????? ???????? ???? ?????? `$AOS_LOGS_PATH/tmp/logs/`.

??????????

  1. ????????? ?? script ???? web server:
    https://localhost/aos/examples/case-studies/ui/ui_event_binding/ui_event_binding.php
    
  2. ????????????? ?? ?????? ?? JavaScript:
    fetch('/aos/examples/case-studies/ui/ui_event_binding/ui_event_binding.php', {
      method: 'POST',
      body: JSON.stringify({ event: 'ui.onClick', elementId: 'submitButton' }),
      headers: { 'Content-Type': 'application/json' }
    });
    
  3. ? ?????????????? jQuery ??? ??????? ??????:
    <button id="submitButton">???????</button>
    <script>
      $('#submitButton').on('click', function() {
        $.ajax({
          url: 'server.php',
          type: 'POST',
          data: {
            target: 'ui',
            eventType: 'onClick',
            elementId: 'submitButton',
            formData: { name: '???????', email: 'user@example.com' }
          },
          success: function(response) {
            console.log(response);
          }
        });
      });
    </script>
    

?????????? ??????

$eventHandler->register('ui', 'onClick', fn($params) => processForm($params));
$eventHandler->trigger('ui', 'onClick', $data);

??????????? ??????????

?? script ?????????? ?? ?????? ??? ??????????:

????????? ????????: ????? = ???????, Email = user@example.com

?????

??????????

?????? ?? ???????????? ?? ???? ?? ??????; ???? fork ?? ??????????, ??????????? ? ????????? ?? ui_event_binding.php ??? ??????? pull request. ??? ?? CONTRIBUTING.md ??? ???????.

????? ??????

???? ? ?????? ?????????? ?????????? ??? ??? Ascoos General License (AGL). ??? ?? LICENSE.