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

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.
主站蜘蛛池模板: 苍南县| 乌拉特后旗| 托里县| 韶关市| 深圳市| 周宁县| 建水县| 金沙县| 宣城市| 翁牛特旗| 三明市| 长垣县| 苗栗县| 济南市| 泽普县| 五台县| 安义县| 万载县| 灵武市| 商城县| 玉林市| 松原市| 瑞丽市| 乌苏市| 望城县| 龙南县| 泽库县| 平阴县| 屏东县| 鹤庆县| 克东县| 卢龙县| 万盛区| 大宁县| 封丘县| 宜川县| 平谷区| 全椒县| 上蔡县| 吉木萨尔县| 南充市|