Skip to content

Commit 63e79e2

Browse files
committed
Pass Typed.js through Dependency Injection
1 parent 3301686 commit 63e79e2

11 files changed

+23
-78
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ For each **Shell** instance you can set the following options:
3030
| style | `'custom'`|`'ubuntu'`|`'osx'`|`'windows'` | The operating system (default: `'custom'`) |
3131
| theme | `'dark'`|`'light'` | The theme (default: `'dark'`) |
3232
| responsive | `false`|`true` | If `true` the terminal will be fluid (default: `false`) |
33-
| typed | `false`|`true` | Adds the **[Typed.js][typedjs]** integration (default: `false`) |
33+
| typed | `false`|*Typed instance* | Adds the **[Typed.js][typedjs]** integration (default: `false`) |
3434
| commands | array | The commands list (default: `[]`) |
3535

3636

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shell.js",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "A JavaScript and CSS library to create terminals",
55
"author": "Davide Caruso <davide.caruso93@gmail.com>",
66
"license": "MIT",

demo/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<script src="../lib/shell.min.js"></script>
88
<script>
99
document.addEventListener('DOMContentLoaded', function() {
10-
let a = new Shell('#awesome-shell', {
10+
let shell = new Shell('#awesome-shell', {
1111
style: 'osx',
1212
commands: ['sudo -i'],
13-
typed: true
13+
typed: Typed
1414
});
1515
});
1616
</script>

lib/shell.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/shell.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/shell.min.js

+2-62
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/shell.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shell.js",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "A JavaScript and CSS library to create terminals",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",

src/js/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const defaults = {
3131
theme: 'dark',
3232

3333
/**
34-
* @property {string} theme Adds the Typed.js integration
34+
* @property {(boolean|function)} theme Adds the Typed.js integration
3535
*/
3636
typed: false,
3737

src/js/shell.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ module.exports = class Shell {
5757
this.el[0].innerHTML = this.buildStatusBar() + this.buildContent();
5858

5959
/// Typed.js integration
60-
if (this.options.typed && typeof Typed !== 'undefined') {
61-
60+
if (this.options.typed && typeof this.options.typed === 'function') {
61+
let Typed = this.options.typed;
6262
let commandsNum = this.el[0].querySelectorAll('.line').length;
6363
let initCommands = (i) => {
6464

webpack.config.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ let plugins = [
2727
autoprefixer(),
2828
]
2929
}
30-
}),
31-
new webpack.BannerPlugin(banner),
30+
})
3231
];
3332

3433
/// If is build environment
@@ -38,11 +37,17 @@ if (env === 'build') {
3837
sourceMap: true,
3938
mangle: {
4039
except: ['Shell']
40+
},
41+
output: {
42+
comments: false
4143
}
4244
}));
4345
outputFilename = `${filename}.min.js`;
4446
}
4547

48+
/// Add banner
49+
plugins.push(new webpack.BannerPlugin(banner));
50+
4651
/// Export Webpack config
4752
module.exports = {
4853
devtool: 'nosources-source-map',

0 commit comments

Comments
 (0)