Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
var bitlist, kids, singers, song;song = ["do", "re", "mi", "fa", "so"]                                            song = [...
var cube, square;                                square = function(x) {                                   return x * x;squ...
var Animal, Horse, Snake, sam, tom;                                         // js                                         ...
enchant.Class.create(enchant.Scene, {class SceneMain extends enchant.Scene     initialize: function() {  constructor: () -...
var constructor = function() { __extends = function(child, parent) {      if (this instanceof constructor) {   for (var ke...
var Hoge = enchant.Class.create({                        name: {class Hoge                          get: function() {  nam...
!
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Coffee Scriptでenchant.js
Upcoming SlideShare
Loading in …5
×

Coffee Scriptでenchant.js

21,618 views

Published on

enchant.js meetup!大阪での発表資料

Published in: Technology, Education
  • Be the first to comment

Coffee Scriptでenchant.js

  1. 1. var bitlist, kids, singers, song;song = ["do", "re", "mi", "fa", "so"] song = ["do", "re", "mi", "fa", "so"];singers = {Jagger: "Rock", Elvis: "Roll"} singers = { Jagger: "Rock",bitlist = [ Elvis: "Roll" 1, 0, 1 }; 0, 0, 1 1, 1, 0 bitlist = [1, 0, 1, 0, 0, 1, 1, 1, 0];] kids = {kids = brother: { brother: name: "Max", name: "Max" age: 11 age: 11 }, sister: sister: { name: "Ida" name: "Ida", age: 9 age: 9 } };
  2. 2. var cube, square; square = function(x) { return x * x;square = (x) -> x * x };cube = (x) -> square(x) * x cube = function(x) { return square(x) * x; };
  3. 3. var Animal, Horse, Snake, sam, tom; // js Animal = (function() { function Animal(name) { this.name = name; } Animal.prototype.move = function(meters) { return alert(this.name + (" moved " + meters + "m."));class Animal }; constructor: (@name) -> return Animal; })(); move: (meters) -> alert @name + " moved #{meters}m." Snake = (function() { __extends(Snake, Animal);class Snake extends Animal function Snake() { move: -> alert "Slithering..." Snake.__super__.constructor.apply(this, super 5 arguments); } Snake.prototype.move = function() { alert("Slithering..."); return Snake.__super__.move.call(this, 5); }; return Snake; })();
  4. 4. enchant.Class.create(enchant.Scene, {class SceneMain extends enchant.Scene initialize: function() { constructor: () -> enchant.Scene.call(this); super() } });
  5. 5. var constructor = function() { __extends = function(child, parent) { if (this instanceof constructor) { for (var key in parent) { constructor.prototype.initialize.apply(this if (__hasProp.call(parent, key)) } else { child[key] = parent[key]; return new constructor(); } } function ctor() { }; this.constructor = child; constructor.prototype = Object.create(superclas } constructor.prototype.constructor = constructor ctor.prototype = parent.prototype; if (constructor.prototype.initialize == null) { child.prototype = new ctor; constructor.prototype.initialize = function() child.__super__ = parent.prototype; superclass.apply(this, arguments); return child; };}; } return constructor;
  6. 6. var Hoge = enchant.Class.create({ name: {class Hoge get: function() { name: return "tom"; get: () -> } "tom" } });hoge = new Hogehoge.name // Object var hoge = new Hoge(); hoge.name; // “tom”
  7. 7. !

×