Modules

export

export var TYPE = 3 export def mult a,b a * b export class Todo def initialize self export tag TodoView def render <self> data:titlevar Imba = require('imba'); var TYPE = exports.TYPE = 3; function mult(a,b){ return a * b; }; exports.mult = mult; function Todo(){ this; }; exports.Todo = Todo; // export class var TodoView = Imba.defineTag('TodoView', function(tag){ tag.prototype.render = function (){ return this.$open(0).setChildren(this.data().title,3).synced(); }; }) exports.TodoView = TodoView;

import

# index.imba import {mult,Todo,TodoView,TYPE} from './somefile' var todo = Todo.new var result = mult(1,2) var view = <TodoView[todo]>var Imba = require('imba'), _1 = Imba.createElement; // index.imba var somefile$ = require('./somefile'), mult = somefile$.mult, Todo = somefile$.Todo, TodoView = somefile$.TodoView, TYPE = somefile$.TYPE; var todo = new Todo(); var result = mult(1,2); var view = (_1(TodoView)).setData(todo).end();

require

var fs = require 'fs' var stuff = require './somefile' var body = fs.readFileSync('something.txt') var todo = stuff.Todo.new var result = stuff.mult(1,2)var fs = require('fs'); var stuff = require('./somefile'); var body = fs.readFileSync('something.txt'); var todo = new (stuff.Todo)(); var result = stuff.mult(1,2);

Require works exactly like in plain JavaScript