PHP code example of hhvm / xhp-js

1. Go to this page and download the library: Download hhvm/xhp-js library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hhvm / xhp-js example snippets

Hack
xhp class JsCallExample extends HTML\element {
  use XHPHTMLHelpers;
  use XHPJSCall;

  <<__Override>>
  protected function renderAsync(): Awaitable<x\node> {
    $this->jsCall(
      'ModuleName',
      'functionName',
      'First argument',
      // This passes the DOM node corresponding to the <div /> below
      $this->toJSElementRef(),
      'Third argument',
    );

    return <div id={$this->getID()} />;
  }
}

$xhp = <html><head /><body>
  <x_js_scope><JsCallExample /><x_js_scope>
</body></html>;
echo await $xhp->toStringAsync();
Hack
$this->jsCall('MyModule', 'myMethod', 'argument');