Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Commit

Permalink
Size optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Jan 28, 2017
1 parent 252fb28 commit 50891a0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ Object.defineProperty(VNode.prototype, 'props', {

let oldEventHook = options.event;
options.event = e => {
e.persist = Object;
if (oldEventHook) e = oldEventHook(e);
e.persist = Object;
e.nativeEvent = e;
return e;
};
Expand Down Expand Up @@ -375,7 +375,9 @@ function shallowDiffers(a, b) {
}


let findDOMNode = component => component && component.base || component;
function findDOMNode(component) {
return component && component.base || component;
}


function F(){}
Expand Down Expand Up @@ -539,8 +541,7 @@ function Component(props, context, opts) {
newComponentHook.call(this, props, context);
}
}
Component.prototype = new PreactComponent();
extend(Component.prototype, {
extend(Component.prototype = new PreactComponent(), {
constructor: Component,

isReactComponent: {},
Expand Down Expand Up @@ -568,7 +569,8 @@ extend(Component.prototype, {
function PureComponent(props, context) {
Component.call(this, props, context);
}
PureComponent.prototype = new Component({}, {}, BYPASS_HOOK);
F.prototype = Component.prototype;
PureComponent.prototype = new F();
PureComponent.prototype.shouldComponentUpdate = function(props, state) {
return shallowDiffers(this.props, props) || shallowDiffers(this.state, state);
};
Expand Down

0 comments on commit 50891a0

Please sign in to comment.