Daxe
Daxe
Home pageSummaryPage for printing<-->

Creating a new extension

An extension of Daxe has to be implemented in Dart, so the Dart SDK needs to be installed. Daxe's API documentation can be generated from the the source with the dartdoc command launched in the root of the source tree (the daxe directory).

An extension is a Dart web application. Here is a basic example, adding a new display type named mydn with the class MyDN. This code would be in a file named my_daxe.dart:

      library my_daxe;
      
      import 'package:daxe/daxe.dart';
      part 'my_dn.dart';
      
      void main() {
        NodeFactory.addCoreDisplayTypes();
        
        setDisplayType('mydn',
              (x.Element ref) => new MyDN.fromRef(ref),
              (x.Node node, DaxeNode parent) => new MyDN.fromNode(node, parent)
          );
      
        Strings.load().then((bool b) {
          initDaxe();
        }).catchError((e) {
          h.document.body.appendText('Error when loading the strings.');
        });
      }
    
Previous pageNext page