pocketlang/docs/Reference/term.md
Thakee Nathees 5bc9dcad6b method bind implemented
- MethodBind type added.
- Now methods are first class and can be passed around as arguments
  store as a variable and return it from a function and they're first
  class callbales.
- Can bind instance to a method bind using .bind() method
- Class.methods() method added -> return a list of all methods as
  method binds
- Module.globals() method added -> returns a list of all globals
  of that module.
- Var._class -> attribute added which will return the class of the
  variable
- Class.name, MethodBind.name, Closure.name attribute and Modue._name
  attribute added
- Class._docs, Closure._docs, MethodBind._docs attribute added
- MethodBind.instance attribute added
2022-06-06 02:47:31 +05:30

77 lines
1.3 KiB
Markdown

# term
### init
```ruby
term.init(capture_events:Bool) -> Null
```
Initialize terminal with raw mode for tui applications, set [capture_events] true to enable event handling.
### cleanup
```ruby
term.cleanup() -> Null
```
Cleanup and resotre the last terminal state.
### isatty
```ruby
term.isatty() -> Bool
```
Returns true if both stdin and stdout are tty.
### new_screen_buffer
```ruby
term.new_screen_buffer() -> Null
```
Switch to an alternative screen buffer.
### restore_screen_buffer
```ruby
term.restore_screen_buffer() -> Null
```
Restore the alternative buffer which was created with term.new_screen_buffer()
### getsize
```ruby
term.getsize() -> types.Vector
```
Returns the screen size.
### getposition
```ruby
term.getposition() -> types.Vector
```
Returns the cursor position in the screen on a zero based coordinate.
### read_event
```ruby
term.read_event(event:term.Event) -> Bool
```
Read an event and update the argument [event] and return true.If no event was read it'll return false.
## Event
The terminal event type, that'll be used at term.read_event function to fetch events.
### binary_mode
```ruby
term.binary_mode() -> Null
```
On windows it'll set stdout to binary mode, on other platforms this function won't make make any difference.