UNPKG

reflux-core

Version:

A simple library for uni-directional dataflow application architecture inspired by ReactJS Flux

29 lines (23 loc) 857 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bindMethods = bindMethods; function bindMethods(store, definition) { for (var name in definition) { if (Object.getOwnPropertyDescriptor && Object.defineProperty) { var propertyDescriptor = Object.getOwnPropertyDescriptor(definition, name); if (!propertyDescriptor.value || typeof propertyDescriptor.value !== "function" || !definition.hasOwnProperty(name)) { continue; } store[name] = definition[name].bind(store); } else { var property = definition[name]; if (typeof property !== "function" || !definition.hasOwnProperty(name)) { continue; } store[name] = property.bind(store); } } return store; }