es5 で書くときの雛形。
es2015は、まだIEへの対応が弱いらしいので、
es5で書かなくてはならないときに使う。
使い方
'MyClassName' の箇所を任意のクラス名に置き換えて使う。
jQueryのパス適宜修正が必要 ※lib/jquery-1.8.2.min の部分。
(不要なら消す)
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['lib/jquery-1.8.2.min'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS
} else {
// Browser globals
global.MyClassName = factory(jQuery);
}
}((this.self || global), function ($) {
'use strict';
var MyClassName = function(){
};
MyClassName.prototype = {
constructor: MyClassName,
test: function(){
alert('test');
}
}
return MyClassName;
}));