Added full commander expand

This commit is contained in:
Devine Lu Linvega
2019-07-20 15:49:34 +09:00
parent 7d88b6deb8
commit 93c69db908
6 changed files with 48 additions and 15 deletions

View File

@@ -188,9 +188,9 @@ function Commander (ronin) {
// Display
this.show = function () {
this.show = function (expand = false) {
if (this.isVisible === true) { return }
ronin.el.className = ''
ronin.el.className = expand ? 'expand' : ''
this.isVisible = true
}
@@ -200,9 +200,9 @@ function Commander (ronin) {
this.isVisible = false
}
this.toggle = function () {
this.toggle = function (expand = false) {
if (this.isVisible !== true) {
this.show()
this.show(expand)
} else {
this.hide()
}

View File

@@ -60,6 +60,12 @@ function Library (ronin) {
return rect
}
// Strings
this.concat = function (...items) {
return items.reduce((acc, item) => { return `${acc}${item}` }, '')
}
// Math
this.add = (...args) => { // Adds values.
@@ -319,7 +325,17 @@ function Library (ronin) {
return ronin.surface.open(path)
}
this.folder = (path = ronin.source.path) => { // Returns the content of a folder path.
// File System
this.path = (path = ronin.source.path) => { // Returns the content of a folder path.
return path
}
this.folder = (path = this.path()) => { // Returns the path of the current folder.
return require('path').dirname(path)
}
this.ls = (path = this.folder()) => { // Returns the content of a folder path.
return fs.existsSync(path) ? fs.readdirSync(path) : []
}