|
| 1 | +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
| 2 | +(function (global, factory) { |
| 3 | + if (typeof define === "function" && define.amd) { |
| 4 | + define(["module", "exports"], factory); |
| 5 | + } else if (typeof exports !== "undefined") { |
| 6 | + factory(module, exports); |
| 7 | + } else { |
| 8 | + var mod = { |
| 9 | + exports: {} |
| 10 | + }; |
| 11 | + factory(mod, mod.exports); |
| 12 | + global.Book = mod.exports; |
| 13 | + } |
| 14 | +})(this, function (module, exports) { |
| 15 | + "use strict"; |
| 16 | + |
| 17 | + Object.defineProperty(exports, "__esModule", { |
| 18 | + value: true |
| 19 | + }); |
| 20 | + |
| 21 | + function _classCallCheck(instance, Constructor) { |
| 22 | + if (!(instance instanceof Constructor)) { |
| 23 | + throw new TypeError("Cannot call a class as a function"); |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | + var _createClass = function () { |
| 28 | + function defineProperties(target, props) { |
| 29 | + for (var i = 0; i < props.length; i++) { |
| 30 | + var descriptor = props[i]; |
| 31 | + descriptor.enumerable = descriptor.enumerable || false; |
| 32 | + descriptor.configurable = true; |
| 33 | + if ("value" in descriptor) descriptor.writable = true; |
| 34 | + Object.defineProperty(target, descriptor.key, descriptor); |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + return function (Constructor, protoProps, staticProps) { |
| 39 | + if (protoProps) defineProperties(Constructor.prototype, protoProps); |
| 40 | + if (staticProps) defineProperties(Constructor, staticProps); |
| 41 | + return Constructor; |
| 42 | + }; |
| 43 | + }(); |
| 44 | + |
| 45 | + var Book = function () { |
| 46 | + function Book(title) { |
| 47 | + _classCallCheck(this, Book); |
| 48 | + |
| 49 | + this.title = title; |
| 50 | + } |
| 51 | + |
| 52 | + _createClass(Book, [{ |
| 53 | + key: "printTitle", |
| 54 | + value: function printTitle() { |
| 55 | + console.log(this.title); |
| 56 | + } |
| 57 | + }]); |
| 58 | + |
| 59 | + return Book; |
| 60 | + }(); |
| 61 | + |
| 62 | + exports.default = Book; |
| 63 | + module.exports = exports["default"]; |
| 64 | +}); |
| 65 | + |
| 66 | +},{}],2:[function(require,module,exports){ |
| 67 | +(function (global, factory) { |
| 68 | + if (typeof define === "function" && define.amd) { |
| 69 | + define(["exports"], factory); |
| 70 | + } else if (typeof exports !== "undefined") { |
| 71 | + factory(exports); |
| 72 | + } else { |
| 73 | + var mod = { |
| 74 | + exports: {} |
| 75 | + }; |
| 76 | + factory(mod.exports); |
| 77 | + global.CalcArea = mod.exports; |
| 78 | + } |
| 79 | +})(this, function (exports) { |
| 80 | + "use strict"; |
| 81 | + |
| 82 | + Object.defineProperty(exports, "__esModule", { |
| 83 | + value: true |
| 84 | + }); |
| 85 | + var circleArea = exports.circleArea = function circleArea(r) { |
| 86 | + return 3.14 * Math.pow(r, 2); |
| 87 | + }; |
| 88 | + |
| 89 | + var squareArea = exports.squareArea = function squareArea(s) { |
| 90 | + return s * s; |
| 91 | + }; |
| 92 | + |
| 93 | + // export { circleArea, squareArea }; // {1} |
| 94 | + exports.circle = circleArea; |
| 95 | + exports.square = squareArea; |
| 96 | +}); |
| 97 | + |
| 98 | +},{}],3:[function(require,module,exports){ |
| 99 | +(function (global, factory) { |
| 100 | + if (typeof define === "function" && define.amd) { |
| 101 | + define(['./17-CalcArea', './17-Book'], factory); |
| 102 | + } else if (typeof exports !== "undefined") { |
| 103 | + factory(require('./17-CalcArea'), require('./17-Book')); |
| 104 | + } else { |
| 105 | + var mod = { |
| 106 | + exports: {} |
| 107 | + }; |
| 108 | + factory(global.CalcArea, global.Book); |
| 109 | + global.ES2015ES6Modules = mod.exports; |
| 110 | + } |
| 111 | +})(this, function (_CalcArea, _Book) { |
| 112 | + 'use strict'; |
| 113 | + |
| 114 | + var area = _interopRequireWildcard(_CalcArea); |
| 115 | + |
| 116 | + var _Book2 = _interopRequireDefault(_Book); |
| 117 | + |
| 118 | + function _interopRequireDefault(obj) { |
| 119 | + return obj && obj.__esModule ? obj : { |
| 120 | + default: obj |
| 121 | + }; |
| 122 | + } |
| 123 | + |
| 124 | + function _interopRequireWildcard(obj) { |
| 125 | + if (obj && obj.__esModule) { |
| 126 | + return obj; |
| 127 | + } else { |
| 128 | + var newObj = {}; |
| 129 | + |
| 130 | + if (obj != null) { |
| 131 | + for (var key in obj) { |
| 132 | + if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; |
| 133 | + } |
| 134 | + } |
| 135 | + |
| 136 | + newObj.default = obj; |
| 137 | + return newObj; |
| 138 | + } |
| 139 | + } |
| 140 | + |
| 141 | + // @ts-check |
| 142 | + // import { circleArea, squareArea } from './17-CalcArea'; // {2} |
| 143 | + // import { circleArea as circle } from './17-CalcArea'; |
| 144 | + |
| 145 | + // console.log(circleArea(2)); |
| 146 | + // console.log(squareArea(2)); |
| 147 | + |
| 148 | + |
| 149 | + /* Different way of importing the module */ |
| 150 | + console.log(area.circle(2)); // we need the .js to run this code in the browser |
| 151 | + |
| 152 | + console.log(area.square(2)); |
| 153 | + |
| 154 | + var myBook = new _Book2.default('some title'); |
| 155 | + myBook.printTitle(); |
| 156 | +}); |
| 157 | + |
| 158 | +},{"./17-Book":1,"./17-CalcArea":2}]},{},[3]); |
0 commit comments