官术网_书友最值得收藏!

Importing and using external classes 

An import can be accomplished with the keyword import, and can be declared in different ways, depending on what library you are using. An example of using Require.js is as follows:

  • Go back to your text editor, create a file called import.ts, and add the following code:
import MyBand = require('./export');
console.log(Myband());

 An example of using Common.js is as follows:

import { MyBand } from './export';
console.log(new Myband(['ZZ Top', 'Motorhead'], 3));
  • The second method has been adopted by the Angular team, because Angular uses Webpack, a module bundler building modern web applications.
主站蜘蛛池模板: 沂南县| 济南市| 大关县| 内黄县| 修武县| 饶河县| 涿鹿县| 新乐市| 沾益县| 五莲县| 西乌珠穆沁旗| 科技| 峨眉山市| 确山县| 葵青区| 靖安县| 沈阳市| 梁河县| 封丘县| 德江县| 中卫市| 淮滨县| 香港 | 石狮市| 长白| 崇文区| 富阳市| 南宫市| 伽师县| 石楼县| 南皮县| 博客| 新绛县| 汝州市| 常山县| 平顺县| 富锦市| 滨州市| 玉田县| 临武县| 九江市|