riot.hx

haxe wrapper around riot.js
https://github.com/francescoagati/riot.hx

To install, run:

haxelib install riot.hx 0.1.1 

See using Haxelib in Haxelib documentation for more information.

README.md

riot.hx

haxe wrapper around Riot.js

for install from git

haxelib git riot.hx https://github.com/francescoagati/riot.hx.git

in you code (see folder test for complete example)

haxe component

using riot.RiotTools;

@:tagName('counter')
@:templateFile('templates/counter/counter.html')
@:cssFile('templates/counter/counter.css')
@:autoMount
@:keep
class Component implements riot.IRiotComponent {
  public var view:Dynamic;


  @:bind function incr() {
    view.counter++;
  }

  @:bind function async_incr() {
    haxe.Timer.delay(function() {
      view.counter++;
      update();
    },2000);
  }

  function mount() {
    trace('component mounted on $root()');
    untyped console.log(root());
  }

  public function new(v,opts) {
    bind_view(v);
    view.counter = 0;
    view.on('mount',mount);
  }

}

your template riot

<button onclick={incr}>incr</button>
<button onclick={async_incr}>async incr</button>
<span class="counter">{counter}</span>

your template css injected during the definition of component

  .counter {
    background:red;
    color:yellow;
  }

in your html page

<html>
  <head>
    <script src="/api/public/p/aHR0cDovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9yaW90LzIuMC4xNS9yaW90Lm1pbi5qcw"></script>

  </head>
  <body>
    <counter></counter>
    <script src="/api/public/p/aHR0cHM6Ly9saWIuaGF4ZS5vcmcvcC90ZXN0Lmpz"></script>
  </body>
</html>

example with haxe code compiled to javascript http://jsfiddle.net/ohtfow3z/1/

Contributors
francescoagati
Version
0.1.1
Published
11 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂