Skip to content

Commit

Permalink
Pass Typed.js through Dependency Injection
Browse files Browse the repository at this point in the history
  • Loading branch information
davidecaruso committed Oct 11, 2017
1 parent 3301686 commit 63e79e2
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 78 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ For each **Shell** instance you can set the following options:
| style | `'custom'`|`'ubuntu'`|`'osx'`|`'windows'` | The operating system (default: `'custom'`) |
| theme | `'dark'`|`'light'` | The theme (default: `'dark'`) |
| responsive | `false`|`true` | If `true` the terminal will be fluid (default: `false`) |
| typed | `false`|`true` | Adds the **[Typed.js][typedjs]** integration (default: `false`) |
| typed | `false`|*Typed instance* | Adds the **[Typed.js][typedjs]** integration (default: `false`) |
| commands | array | The commands list (default: `[]`) |


Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shell.js",
"version": "2.0.4",
"version": "2.0.5",
"description": "A JavaScript and CSS library to create terminals",
"author": "Davide Caruso <[email protected]>",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<script src="../lib/shell.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
let a = new Shell('#awesome-shell', {
let shell = new Shell('#awesome-shell', {
style: 'osx',
commands: ['sudo -i'],
typed: true
typed: Typed
});
});
</script>
Expand Down
8 changes: 4 additions & 4 deletions lib/shell.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/shell.js.map

Large diffs are not rendered by default.

64 changes: 2 additions & 62 deletions lib/shell.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/shell.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shell.js",
"version": "2.0.4",
"version": "2.0.5",
"description": "A JavaScript and CSS library to create terminals",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
2 changes: 1 addition & 1 deletion src/js/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const defaults = {
theme: 'dark',

/**
* @property {string} theme Adds the Typed.js integration
* @property {(boolean|function)} theme Adds the Typed.js integration
*/
typed: false,

Expand Down
4 changes: 2 additions & 2 deletions src/js/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ module.exports = class Shell {
this.el[0].innerHTML = this.buildStatusBar() + this.buildContent();

/// Typed.js integration
if (this.options.typed && typeof Typed !== 'undefined') {

if (this.options.typed && typeof this.options.typed === 'function') {
let Typed = this.options.typed;
let commandsNum = this.el[0].querySelectorAll('.line').length;
let initCommands = (i) => {

Expand Down
9 changes: 7 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ let plugins = [
autoprefixer(),
]
}
}),
new webpack.BannerPlugin(banner),
})
];

/// If is build environment
Expand All @@ -38,11 +37,17 @@ if (env === 'build') {
sourceMap: true,
mangle: {
except: ['Shell']
},
output: {
comments: false
}
}));
outputFilename = `${filename}.min.js`;
}

/// Add banner
plugins.push(new webpack.BannerPlugin(banner));

/// Export Webpack config
module.exports = {
devtool: 'nosources-source-map',
Expand Down

0 comments on commit 63e79e2

Please sign in to comment.