This file contains hidden or 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
| (function main() { | |
| getLargeNumber() | |
| .then(function (number) { | |
| console.log('We got ' + number); | |
| }); | |
| })(); | |
| function getLargeNumber() { | |
| return new Promise(function (resolve, reject) { | |
| setTimeout(() => { |
This file contains hidden or 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
| var reject = function (err) { | |
| if (status !== PENDING) return; | |
| error_callbacks.forEach(cb => cb.call(null, err)); | |
| error_callbacks = []; | |
| status = REJECTED; | |
| }; |
This file contains hidden or 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
| var resolve = function (value) { | |
| if (status !== PENDING) return; | |
| try { | |
| success_callbacks.forEach(cb => cb.call(null, value)); | |
| success_callbacks = []; | |
| status = RESOLVED; | |
| } catch (e) { | |
| this.reject(e); | |
| } |
This file contains hidden or 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
| var PENDING = 1; | |
| var RESOLVED = 2; | |
| var REJECTED = 3; | |
| var PENDING = 1; | |
| var RESOLVED = 2; | |
| var REJECTED = 3; | |
| function Promise(executorFunction) { | |
| var status = PENDING; |
This file contains hidden or 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
| function Foo() { | |
| this.name = 'Hello'; | |
| } | |
| function Bar() { | |
| Foo.call(this); | |
| this.age = 31; | |
| } | |
| Bar.prototype = Object.create(Foo.prototype); |
This file contains hidden or 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
| function Foo() { | |
| this.name = 'Hello'; | |
| } | |
| function Bar() { | |
| Foo.call(this); | |
| this.age = 31; | |
| } | |
| Bar.prototype = Object.create(Foo.prototype); |
This file contains hidden or 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
| function Foo() { | |
| this.name = 'Hello'; | |
| } | |
| function Bar() { | |
| Foo.call(this); | |
| this.age = 31; | |
| } |
This file contains hidden or 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 PropTypes from 'prop-types'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <div className="container"> | |
| <div className="row"> | |
| <div className="col-md-12"> | |
| {this.props.message} |
This file contains hidden or 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 { connect } from 'react-redux'; | |
| import App from './App'; | |
| function mapStateToProps(state) { | |
| return {}; | |
| } | |
| function mapDispatchToProps(dispatch) { | |
| return {}; | |
| } |
This file contains hidden or 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 from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { Provider } from 'react-redux'; | |
| import store from './store'; | |
| import './index.css'; | |
| import './lib/bootstrap.min.css'; | |
| import AppContainer from './AppContainer'; | |
| import registerServiceWorker from './registerServiceWorker'; | |
| ReactDOM.render( |