Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-hot-loader

Package Overview
Dependencies
Maintainers
1
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hot-loader - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

example/b.jsx

@@ -8,3 +8,3 @@ /** @jsx React.DOM */

return (
<div style={{background: 'purple',color: 'white'}}>
<div style={{background: 'purple', color: 'white'}}>
<p>I am <code>example/b.jsx</code>, feel free to edit me.</p>

@@ -11,0 +11,0 @@ <img src='http://facebook.github.io/react/img/logo_og.png' width='200' />

'use strict';
var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
/* jshint proto:true */
obj.__proto__ = proto;
return obj;
};
module.exports = function (React) {

@@ -22,53 +16,66 @@ var mounted = [];

var assimilatePrototype = (function () {
var storedPrototype;
var storedPrototype,
knownPrototypes = [];
function assimilateProperty(freshPrototype, key) {
function get() {
if (typeof storedPrototype[key] !== 'function' ||
key === 'type' ||
key === 'constructor') {
return storedPrototype[key];
function wrapFunction(key) {
return function () {
if (storedPrototype[key]) {
return storedPrototype[key].apply(this, arguments);
}
};
}
return function () {
var value = storedPrototype[key];
if (typeof value === 'function') {
return value.apply(this, arguments);
} else {
console.warn('A call to ' + key + ' was made after it was deleted. Acting as no-op.');
}
};
function patchProperty(proto, key) {
proto[key] = storedPrototype[key];
if (typeof proto[key] !== 'function' ||
key === 'type' ||
key === 'constructor') {
return;
}
function set(value) {
storedPrototype[key] = value;
proto[key] = wrapFunction(key);
if (proto.__reactAutoBindMap[key]) {
proto.__reactAutoBindMap[key] = proto[key];
}
storedPrototype[key] = freshPrototype[key];
Object.defineProperty(freshPrototype, key, {
configurable: false,
enumerable: true,
get: get,
set: set
});
}
return function assimilatePrototype(freshPrototype) {
function updateStoredPrototype(freshPrototype) {
storedPrototype = {};
for (var key in freshPrototype) {
assimilateProperty(freshPrototype, key);
if (freshPrototype.hasOwnProperty(key)) {
storedPrototype[key] = freshPrototype[key];
}
}
}
function reconcileWithStoredPrototypes(freshPrototype) {
knownPrototypes.push(freshPrototype);
knownPrototypes.forEach(function (proto) {
for (var key in storedPrototype) {
patchProperty(proto, key);
}
});
}
return function (freshPrototype) {
updateStoredPrototype(freshPrototype);
reconcileWithStoredPrototypes(freshPrototype);
};
})();
function injectMixinAndAssimilatePrototype(spec) {
spec.mixins = spec.mixins || [];
spec.mixins.push(Mixin);
var Component = React.createClass(spec);
assimilatePrototype(Component.type.prototype);
return Component;
}
var Component;
return {
createClass: function (spec) {
spec.mixins = spec.mixins || [];
spec.mixins.push(Mixin);
Component = React.createClass(spec);
assimilatePrototype(Component.componentConstructor.prototype);
Component = injectMixinAndAssimilatePrototype(spec);
return Component;

@@ -78,4 +85,3 @@ },

updateClass: function (spec) {
var UpdatedComponent = React.createClass(spec);
assimilatePrototype(UpdatedComponent.componentConstructor.prototype);
injectMixinAndAssimilatePrototype(spec);

@@ -82,0 +88,0 @@ mounted.forEach(function (instance) {

{
"name": "react-hot-loader",
"version": "0.1.5",
"version": "0.1.6",
"description": "Webpack loader that enables live-editing React components without unmounting or losing their state",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc