Constructor
new Gtube(search, options)
Represents a YouTube instance
Parameters:
Name | Type | Description |
---|---|---|
search |
String | Search string |
options |
Options | Options |
Extends
- events.EventEmitter
Methods
item() → {Item}
get item at index
Returns:
- Type
- Item
options() → {Options}
get current Options
Returns:
- Type
- Options
(async) process(newSearch, callback) → {Promise.<Boolean>}
this method searches the provided search string on Youtube for video results.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
newSearch |
Boolean | true | Defines if we are continuing search or starting a new one |
callback |
object | Callback when searching is done. Done assign this until you're absolutely sure what you're doing |
Fires:
- event:cleared
- event:addedItem
Throws:
Error
Returns:
is search was successful or ended with error
- Type
- Promise.<Boolean>
search() → {String}
get current search string
Returns:
- Type
- String
size() → {Number}
length of items
Returns:
- Type
- Number
Events
addedItem
A new item has been added
Properties:
Name | Type | Description |
---|---|---|
item |
Item |
cleared
Indicates that all items have been cleared