Skip to content

Instantly share code, notes, and snippets.

View SoarLin's full-sized avatar
🐢
take it easy

soar_lin SoarLin

🐢
take it easy
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@SoarLin
SoarLin / decorator2.js
Created May 19, 2017 01:38
Decorator 實作範例 2
function Sale(price) {
this.price = price || 100;
this.decorators_list = [];
}
Sale.decorators = {};
Sale.decorators.fedtax = {
getPrice: function(price) {
return price + (price * 5/100);
}
@SoarLin
SoarLin / decorator1.js
Last active May 19, 2017 01:24
Decorator 實作範例 1
function Sale(price) {
this.price = price || 100;
}
Sale.prototype.getPrice = function() {
return this.price;
};
Sale.prototype.decorate = function (decorator) {
var F = function(){},
overrides = this.constructor.decorators[decorator],
i, newobj;
# Webpack 目前設定檔
[TOC]
## 套件安裝
* 主要套件 : `webpack`
* ESLint 檢查: `eslint eslint-loader eslint-plugin-react`
* Babel (ECMAScript6 語法轉換) : `babel-core babel-loader babel-preset-es2015`
* React 相關套件: `react rect-dom jsx-loader babel-preset-react`