global-input-react
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -19,3 +19,3 @@ (function (global, factory) { | ||
}); | ||
exports.GlobalInputReceiver = undefined; | ||
exports.GlobalInputSender = exports.GlobalInputReceiver = undefined; | ||
@@ -105,2 +105,5 @@ var _react2 = _interopRequireDefault(_react); | ||
var options = { onInput: this.onInput.bind(this) }; | ||
if (this.props.onRegistered) { | ||
options.onRegistered = this.props.onRegistered; | ||
} | ||
if (config.metadata) { | ||
@@ -155,2 +158,90 @@ options.metadata = config.metadata.map(function (m) { | ||
}(_react.Component); | ||
var GlobalInputSender = exports.GlobalInputSender = function (_Component2) { | ||
_inherits(GlobalInputSender, _Component2); | ||
function GlobalInputSender(props) { | ||
_classCallCheck(this, GlobalInputSender); | ||
var _this2 = _possibleConstructorReturn(this, (GlobalInputSender.__proto__ || Object.getPrototypeOf(GlobalInputSender)).call(this, props)); | ||
_this2.connector = (0, _globalInputMessage.createMessageConnector)(); | ||
return _this2; | ||
} | ||
_createClass(GlobalInputSender, [{ | ||
key: "createUUID", | ||
value: function createUUID() { | ||
function s4() { | ||
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | ||
} | ||
function getTimeValue() { | ||
return new Date().getTime(); | ||
} | ||
return s4() + '-' + getTimeValue(); | ||
} | ||
}, { | ||
key: "disconnect", | ||
value: function disconnect() { | ||
this.connector.disconnect(); | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.disconnect(); | ||
} | ||
}, { | ||
key: "componentWillMount", | ||
value: function componentWillMount() { | ||
var codedata = this.props.codedata; | ||
this.processCodeData(codedata); | ||
} | ||
}, { | ||
key: "processCodeData", | ||
value: function processCodeData(codedata) { | ||
var that = this; | ||
var options = { | ||
onInputPermissionResult: this.onInputPermissionResult.bind(this) | ||
}; | ||
this.connector.processCodeData(options, codedata); | ||
} | ||
}, { | ||
key: "onInputPermissionResult", | ||
value: function onInputPermissionResult(message) { | ||
console.log("*******sender recenved the onInputPermissionResult****"); | ||
var globalInputdata = message.metadata; | ||
globalInputdata.forEach(function (dataitem) { | ||
if (!dataitem.value) { | ||
dataitem.value = ""; | ||
} | ||
}); | ||
this.setState(Object.assign({}, this.state, { globalInputdata: globalInputdata })); | ||
} | ||
}, { | ||
key: "setGlobalInputData", | ||
value: function setGlobalInputData(index, value) { | ||
if (!this.state.globalInputdata) { | ||
console.log("ignored:" + index + ":" + value); | ||
return; | ||
} | ||
var globalInputdata = this.state.globalInputdata.slice(0); | ||
console.log("setting index:" + index + "value:" + value); | ||
globalInputdata[index].value = value; | ||
var message = { | ||
id: this.createUUID, | ||
value: value, | ||
index: index | ||
}; | ||
this.connector.sendInputMessage(message); | ||
this.setState(Object.assign({}, this.state, { globalInputdata: globalInputdata })); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
return null; | ||
} | ||
}]); | ||
return GlobalInputSender; | ||
}(_react.Component); | ||
}); |
{ | ||
"name": "global-input-react", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "global input react component", | ||
@@ -40,10 +40,11 @@ "repository": { | ||
"eslint-plugin-react": "^4.2.3", | ||
"jest": "^20.0.4", | ||
"jsdom": "^8.1.0", | ||
"mocha": "^2.4.5", | ||
"nodemon": "^1.9.1", | ||
"react": "^15.0.0", | ||
"react-addons-test-utils": "^15.0.0", | ||
"react": "^15.0.0", | ||
"react-dom": "^15.0.0", | ||
"sinon": "^1.17.3", | ||
"jest": "^20.0.4" | ||
"react-test-renderer": "^15.6.1", | ||
"sinon": "^1.17.3" | ||
}, | ||
@@ -54,5 +55,5 @@ "peerDependencies": { | ||
"dependencies": { | ||
"global-input-message": "^1.1.19", | ||
"global-input-message": "^1.2.1", | ||
"qrcode.react": "^0.7.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12254
235
22
8
Updatedglobal-input-message@^1.2.1