Skip to content

Instantly share code, notes, and snippets.

View ibare's full-sized avatar
😃
I'm happy!!

Kim Mintae ibare

😃
I'm happy!!
  • WoowaBros
  • seoul, korea
View GitHub Profile
/* webpack raw-loader */
import template from './hello.html';
Vue.component('hello', {
template
});
@ibare
ibare / reducer-utils.js
Last active February 10, 2017 08:14
woowahanjs 리듀서 ajax 호출 전처리, 후처리 미들웨어 사용하기
export function beforeRequest(context, method, url, options = {}) {
method = method.toLowerCase();
let defaultOptions = {
timeout: 1000*10, // 10sec
headers: {
'Authorization': 'Bearer xxx-token-xxx',
'Content-Type':'application/json'
}
};
// before
module.exports = {
api: {
development: {
apiUrl: ""
},
minor: {
apiUrl: ""
}
}
app.all('/v1/*', (req, res) => {
request[req.method.toLowerCase()]({
url: config.ApiServer+req.url,
headers: {
'Authorization': req.headers['authorization'],
'Content-Type': req.headers['content-type']
},
qs: req.query,
json: req.body
}, (err, response, body) => {
Woowahan.View.create('myview', {
events: {
'@transaction fetch-order-info', 'doneAction'
},
doAction() {
this.createTransaction('fetch-order-info', [
Woowahan.Action.create(FETCH_ORDER_INFO, {}),
Woowahan.Action.create(FETCH_MEMBER_INFO, {}),
const fooView = Woowahan.View.create('fooView', {
useStore: {
rules: 'orderRule, bannerRule',
addressInfo: {
props: 'si,gu,gun,detail',
listen: true
},
memberInfo: '*',
orderNo: 'orderInfo.orderNo'
@ibare
ibare / js-exec-context.js
Last active July 11, 2017 05:34
javascript 실행 콘텍스트의 변화
function Foo() {
// this 는 new 연산자로 호출되었을 때를 전제한다
// this 는 인스턴스 객체
this.myname = 'Foo';
this.displayName = function() {
// this 는 인스턴스 객체를 전제한다.
// 따라서 반드시 [인스턴스].displayName() 으로 호출되어야한다
// 그렇게 하지 못할 경우 인스턴스 객체를 바인딩 시켜줘야야 this 가 인스턴스 객체를 가르킨다
// ㄴ displayName.bind([인스턴스])
console.log(this.myname);
@ibare
ibare / package.js
Created July 27, 2017 04:39
Business module package for woowahanjs
import * as actions from './actions';
import * as plugins from './plugins';
import myMiddleware from './middleware/mymiddleware';
import reducers from './reducers';
import views from './views';
export default {
view: views.shopFinder,
setup: function(app) {
@ibare
ibare / bind.js
Created August 2, 2017 05:01
bind function
const myview = Woowahan.View.create('bindExample', {
initialize() {
this.onDragend = this.onDragend.bind(this);
this.super();
},
viewDidMount() {
this.map.addListener(markerId, 'dragend', this.onDragend);
@ibare
ibare / pad.js
Created September 7, 2017 01:46
pad example
var pad = size => num => (Array(size-String(num).length+1)).join('0')+num;