Vue or React. Well lets see the most noticeable features.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentComponent extends Component{ | |
state = { | |
parentValue: '' | |
} | |
handleParentValueChange = (value) => { | |
this.setState({parentValue: value}); | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PARENT WINDOW | |
(function () { | |
function scrollWindow(evt) { | |
var message; | |
if (evt.origin !== "iframe_URL_HERE" ) { | |
message = "Action cannnot be performed"; | |
} else { | |
var x = evt.data.xAxis || 0; | |
var y = evt.data.yAxis || 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IFRAME | |
(function () { | |
const scrollParentWindow = (x = 0, y = 0) => { | |
const parentWin = window.parent, | |
parentExpectedUrl = 'PARENT_URL_HERE', | |
currentParentUrl = `http://${parentWin.location.hostname}` | |
if (parentExpectedUrl === currentParentUrl) { | |
parentWin.postMessage({ | |
xAxis: x, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
export default (ChildComponent) => { | |
class ComposedComponent extends Component { | |
// Our component just got rendered | |
componentDidMount() { | |
this.shouldNavigateAway(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
export default (ChildComponent) => { | |
class ComposedComponent extends Component { | |
// Our component just got rendered | |
componentDidMount() { | |
this.shouldNavigateAway(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: node_js | |
node_js: | |
- "node" | |
env: | |
- NODE_ENV=TEST | |
before_script: | |
- npm install | |
script: | |
- npm run test |
sudo lsof -i :3000
kill -9 {PID}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filters an array of objects with multiple criteria. | |
* | |
* @param {Array} array: the array to filter | |
* @param {Object} filters: an object with the filter criteria as the property names | |
* @return {Array} | |
*/ | |
function multiFilter(array, filters) { | |
const filterKeys = Object.keys(filters); | |
// filters all elements passing the criteria |
OlderNewer