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

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.
主站蜘蛛池模板: 阿城市| 炉霍县| 上虞市| 栾城县| 神池县| 沭阳县| 白朗县| 平顶山市| 醴陵市| 南皮县| 安宁市| 冕宁县| 青龙| 达孜县| 肇州县| 自贡市| 冀州市| 漳浦县| 大理市| 团风县| 大埔区| 泗洪县| 望江县| 于田县| 秭归县| 岚皋县| 拜城县| 北碚区| 米脂县| 城固县| 弥勒县| 疏勒县| 呼伦贝尔市| 武威市| 哈密市| 广西| 裕民县| 驻马店市| 霍山县| 河西区| 喀什市|