Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clayrisser/babel-plugin-gjs
babel plugin for gjs
https://github.com/clayrisser/babel-plugin-gjs
babel cgjs gjs node plugin
Last synced: 3 months ago
JSON representation
babel plugin for gjs
- Host: GitHub
- URL: https://github.com/clayrisser/babel-plugin-gjs
- Owner: clayrisser
- License: mit
- Created: 2019-08-20T19:27:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-07-11T06:16:46.000Z (over 1 year ago)
- Last Synced: 2024-10-22T05:17:33.845Z (3 months ago)
- Topics: babel, cgjs, gjs, node, plugin
- Language: JavaScript
- Homepage: https://codejam.ninja
- Size: 1.11 MB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-gjs
[![GitHub stars](https://img.shields.io/github/stars/codejamninja/babel-plugin-gjs.svg?style=social&label=Stars)](https://github.com/codejamninja/babel-plugin-gjs)
> babel plugin for gjs
For best results, run transpiled code with [CGJS](https://github.com/cgjs/cgjs)
Please ★ this repo if you found it useful ★ ★ ★
## Features
#### Wraps classes with `GObject.registerClass`
##### Before
```js
class MyWindow extends Gtk.Window {
constructor() {
super({ title: 'Hello World' });
this.button = new Gtk.Button({ label: 'Click here' });
this.button.connect('clicked', this.handleClicked);
this.add(this.button);
}handleClicked() {
console.log('Button clicked');
}
}
```##### After
```js
const GObject = imports.gi.GObject;const MyWindow = GObject.registerClass(
class MyWindow extends Gtk.Window {
_init() {
super._init({ title: 'Hello World' });
this.button = new Gtk.Button({ label: 'Click here' });
this.button.connect('clicked', this.handleClicked);
this.add(this.button);
}handleClicked() {
console.log('Button clicked');
}
}
);
```## Installation
```sh
npm install --save-dev babel-plugin-gjs
```_.babelrc_
```json
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "4"
}
}
]
],
"plugins": ["gjs"]
}
```## Dependencies
- [CGJS](https://github.com/cgjs/cgjs)
- [GJS](https://wiki.gnome.org/Projects/Gjs)
- [NodeJS](https://nodejs.org)## Usage
```sh
babel src -d lib
cgjs lib
```## Support
Submit an [issue](https://github.com/codejamninja/babel-plugin-gjs/issues/new)
## Screenshots
[Contribute](https://github.com/codejamninja/babel-plugin-gjs/blob/master/CONTRIBUTING.md) a screenshot
## Contributing
Review the [guidelines for contributing](https://github.com/codejamninja/babel-plugin-gjs/blob/master/CONTRIBUTING.md)
## License
[MIT License](https://github.com/codejamninja/babel-plugin-gjs/blob/master/LICENSE)
[Jam Risser](https://codejam.ninja) © 2018
## Changelog
Review the [changelog](https://github.com/codejamninja/babel-plugin-gjs/blob/master/CHANGELOG.md)
## Credits
- [Jam Risser](https://codejam.ninja) - Author
## Support on Liberapay
A ridiculous amount of coffee ☕ ☕ ☕ was consumed in the process of building this project.
[Add some fuel](https://liberapay.com/codejamninja/donate) if you'd like to keep me going!
[![Liberapay receiving](https://img.shields.io/liberapay/receives/codejamninja.svg?style=flat-square)](https://liberapay.com/codejamninja/donate)
[![Liberapay patrons](https://img.shields.io/liberapay/patrons/codejamninja.svg?style=flat-square)](https://liberapay.com/codejamninja/donate)