Created
November 14, 2012 15:24
-
-
Save hmaurer/4072741 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kotlin.System.flush(); | |
(function () { | |
'use strict'; | |
var _f = { | |
f0: function () { | |
Kotlin.println('Hello world!'); | |
} | |
} | |
, classes = function () { | |
var c0 = Kotlin.createClass({ | |
initialize: function (age) { | |
this.$age = age; | |
}, | |
get_age: function () { | |
return this.$age; | |
} | |
}) | |
, c1 = Kotlin.createTrait({ | |
bark: function () { | |
Kotlin.println('Wouf wouf!'); | |
} | |
}); | |
return {c0: c0, c1: c1}; | |
}() | |
, _ = { | |
LivingThingy: classes.c0, | |
Badass: classes.c1, | |
Puppy: Kotlin.createClass(classes.c0, classes.c1, { | |
initialize: function (name) { | |
this.super_init(12); | |
this.$name = 'Unknown'; | |
{ | |
this.set_name(name); | |
} | |
}, | |
get_name: function () { | |
return this.$name; | |
}, | |
set_name: function (value) { | |
this.$name = value; | |
}, | |
sayHello: function () { | |
Kotlin.println('Hello! My name is ' + this.get_name() + '.'); | |
} | |
}), | |
sayHello: function (callback) { | |
callback(); | |
}, | |
register: function (module) { | |
Kotlin.println('Registering module...'); | |
}, | |
main: function (args) { | |
_.sayHello(_f.f0); | |
_.register('abc'); | |
var puppy = new _.Puppy('Rex'); | |
Kotlin.println(Kotlin.isType(puppy, _.LivingThingy)); | |
puppy.bark(); | |
puppy.sayHello(); | |
} | |
}; | |
Kotlin.defineModule('JS_TESTS', _); | |
_.main([]); | |
}()); | |
Kotlin.System.output(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment