Socket
Socket
Sign inDemoInstall

global-input-react

Package Overview
Dependencies
54
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.3

dist/index.js

61

index.js

@@ -1,60 +0,1 @@

import React, {Component} from 'react'
import {createMessageConnector} from "global-input-message";
import QRCode from "qrcode.react";
export class GlobalInputReceiver extends Component {
getGlobalInputConfig(){
return {};
}
onInput(inputMessage){
this.getGlobalInputConfig().metadata[inputMessage.data.index].onInput(inputMessage.data.value);
}
connectToMessenger(){
this.connector=createMessageConnector();
var config=this.getGlobalInputConfig();
var options={onInput:this.onInput.bind(this)};
if(config.metadata){
options.metadata=config.metadata.map(function(m){
var metadata=Object.assign({},m);
if(metadata.onInput){
delete metadata.onInput
}
return metadata;
});
}
console.log("new metadata:"+options.metadata);
if(config.url){
options.url=config.url;
}
if(config.onInput){
options.onInput=config.onInput;
}
this.connector.connect(options);
}
displayInputCode(){
const inputCodeData=JSON.stringify(this.connector.buildInputCodeData());
return(
<QRCode value={inputCodeData}/>
);
}
disconnectFromMessenger(){
this.connector.disconnect();
}
componentWillMount(){
this.connectToMessenger();
}
componentWillUnmount(){
this.disconnectFromMessenger();
}
render() {
return null;
}
}
module.exports = require('./dist/index');
{
"name": "global-input-react",
"version": "1.0.1",
"version": "1.0.3",
"description": "global input react component",
"main": "index.js",
"scripts": {
"test": "jest"
},
"repository": {

@@ -13,6 +9,2 @@ "type": "git",

},
"keywords": [
"global",
"input"
],
"author": "Dilshat Hewzulla",

@@ -24,11 +16,45 @@ "license": "Apache-2.0",

"homepage": "https://github.com/global-input/global-input-react#readme",
"dependencies": {
"global-input-message": "^1.1.16",
"qrcode.react": "^0.7.1",
"react": "^15.6.1"
"keywords": [
"global input",
"global-input"
],
"options": {
"mocha": "--require scripts/mocha_runner src/**/__tests__/**/*.js"
},
"scripts": {
"prepublish": "babel --plugins transform-es2015-modules-umd src --ignore __tests__ --out-dir ./dist",
"test": "jest"
},
"devDependencies": {
"babel-preset-es2015": "^6.24.1",
"babel-cli": "^6.6.4",
"babel-core": "^6.7.4",
"babel-eslint": "^6.0.2",
"babel-plugin-transform-es2015-modules-umd": "^6.6.5",
"babel-polyfill": "^6.7.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.5.0",
"chai": "^3.5.0",
"enzyme": "^2.2.0",
"eslint": "^2.7.0",
"eslint-plugin-babel": "^3.1.0",
"eslint-plugin-react": "^4.2.3",
"jsdom": "^8.1.0",
"mocha": "^2.4.5",
"nodemon": "^1.9.1",
"react-addons-test-utils": "^15.0.0",
"react": "^15.0.0",
"react-dom": "^15.0.0",
"sinon": "^1.17.3",
"jest": "^20.0.4"
},
"peerDependencies": {
"react": "~0.14.8 || ^15.0.0",
"react-dom": "~0.14.8 || ^15.0.0"
},
"dependencies": {
"babel-runtime": "^6.6.1",
"global-input-message": "^1.1.16",
"qrcode.react": "^0.7.1"
}
}

@@ -1,1 +0,32 @@

# global-input-react
# Boilerplate for creating React Npm packages with ES2015
The package is based on [npm-base](https://github.com/kadirahq/npm-base) package by [Kadira](https://github.com/kadirahq) which is really great when you want to prepare Npm package. This one is prepared to be used as a starter point for React components which needs to be published on Npm.
It includes linting with [ESLint](http://eslint.org/) and testing with [Mocha](https://mochajs.org/), [Enzyme](http://airbnb.io/enzyme/) and [JSDOM](https://github.com/tmpvar/jsdom).
Also there is of course ES6 transpilation.
## Usage
1. Clone this repo
2. Inside cloned repo run `npm install && rm -rf .git && git init` and update `package.json` with your package name.
3. If you want to run tests: `npm test` or `npm run testonly` or `npm run test-watch`. You need to write tests in `__tests__` folder. You need at least Node 4 on your machine to run tests.
4. If you want to run linting: `npm test` or `npm run lint`. Fix bugs: `npm run lint-fix`. You can adjust your `.eslintrc` config file.
5. If you want to run transpilation to ES5 in `dist` folder: `npm run prepublish` (standard npm hook).
## CSS and preprocessors
For more information check out this thread: [#5](https://github.com/juliancwirko/react-npm-boilerplate/issues/5)
## Blog post about it:
- [Creating React NPM packages with ES2015](http://julian.io/creating-react-npm-packages-with-es2015/)
## Also check out
- [React Alert UI component](https://github.com/juliancwirko/react-s-alert)
- [React project boilerplate with Webpack, HMR, React Router](https://github.com/juliancwirko/react-boilerplate)
## License
MIT

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc