Skip to content

Instantly share code, notes, and snippets.

@h5y1m141
Created September 18, 2012 23:18
Show Gist options
  • Save h5y1m141/3746672 to your computer and use it in GitHub Desktop.
Save h5y1m141/3746672 to your computer and use it in GitHub Desktop.
titanium sample use CoffeeScript
User = require('user')
u = new User('太郎')
name = u.getName()
name1 = u.changeName('花子')
Ti.API.info name
Ti.API.info name1
win1 = Ti.UI.createWindow
title:'tab1'
backgroundColor:'#fff'
label1 = Ti.UI.createLabel
text:name
left:5
top:5
height:50
backgroundColor:'#fff'
font:
fontSize:26
fontWeight:'bold'
fontFamily:"Helvetica Neue"
label2 = Ti.UI.createLabel
text:name1
left:5
top:60
height:50
backgroundColor:'#fff'
font:
fontSize:26
fontWeight:'bold'
fontFamily:"Helvetica Neue"
win1.add label1
win1.add label2
win1.open()
class User
constructor: (@name) ->
getName: ->
return @name
changeName:(name) ->
@name = name
module.exports = User
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment