summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* doc: Fix http-client.js examplesonny-master-patch-71423Sonny Piers2023-05-041-1/+1
|
* examples: support no content-length in http-client.jsAndy Holmes2022-08-081-3/+9
| | | | | | | | Adjust the code path where we read the HTTP content, demonstrating `Gio.OutputStream.splice()` which can handle the case where there is no `content-length` header in an HTTP response. fixes #498
* doc: add simple Gtk.TickCallback exampleAndy Holmes2022-08-061-0/+93
| | | | | Add a simple example of using `Gtk.Widget.add_tick_callback()` to demonstrate how it can be used to implement simple tweening.
* doc: Modernize examplesSonny Piers2022-08-0518-117/+183
| | | | | | | | | * Use ES modules * Use `console` * Port examples to GTK4 (except `calc.js` and `webkit.js`) * Port examples to libsoup 3.0 * Don't use `var` * Stop using `bytearray`
* doc: Reflect support for constructor with GObjectSonny Piers2022-07-204-8/+8
|
* examples: Delete Clutter examplePhilip Chimento2022-03-031-25/+0
| | | | | Clutter as a standalone library is being retired. https://discourse.gnome.org/t/retiring-clutter-and-friends/8949
* Implement WHATWG Timers APIEvan Welsh2022-01-141-0/+21
|
* examples: improve the gettext example Sonny Piers2021-08-081-3/+9
| | | gnome-panel-3.0 isn't a thing anymore
* examples: add examples of GtkBuilder templatesAndy Holmes2021-04-244-0/+206
| | | | | Add some basic examples of using GtkBuilder templates in GJS, with a few comments covering the few options available.
* Correct contributor copyright email.Evan Welsh2020-11-301-1/+1
| | | | Future commits will also be made under this email address.
* maint: Add copyright notices based on major file contributorsPhilip Chimento2020-11-3012-0/+12
| | | | | | | | | | | | Based on looking at the git logs, add copyright notices to files which were missing them, assuming the copyright belongs to people who made major contributions to each file. Some assumptions were made as to who to assign the copyright to, such as, what copyright assignment did the contributor make in other files added in the same commit? What email address did they use to make the commit? What copyright assignment did they make in other commits using the same email address?
* lint: Switch to eslint-plugin-jsdoc and remove lint-condo.Evan Welsh2020-11-201-0/+10
| | | | | | | | | | | ESLint has deprecated jsdoc and instead recommends eslint-plugin-jsdoc. lint-condo does not have eslint-plugin-jsdoc. We only use lint-condo for eslint currently and it is simpler to instead use yarn to install and manage eslint. Some module files had JSDoc comments which violated the jsdoc plugin's more stringent rules.
* added rule to handle blank lines at the start of blocksNasah-Kuma2020-10-272-2/+0
|
* maint: Add dual MIT/LGPL license to all GJS files that didn't have onePhilip Chimento2020-10-0412-0/+22
| | | | | | This adds a SPDX-License-Identifier comment to all files that are part of GJS, part of its unit tests, or auxiliary tools. (Except for some files like the debugger scripts that don't support comments.)
* maint: Replace clutter example image with a known license-free onePhilip Chimento2020-10-042-0/+3
| | | | | | | | The provenance of this image wasn't known, so replace it with a new image that is known to be in the public domain. Downloaded from https://www.flickr.com/photos/135396164@N05/30127978380 Dedicated to the public domain, CC0-1.0.
* maint: Add GPL license and copyright to example copied from SeedPhilip Chimento2020-10-041-0/+2
| | | | | This example was originally copied from Seed's examples, so it gets the copyright and license information from Seed.
* examples: Fix Clutter examplePhilip Chimento2020-10-041-7/+4
| | | | I noticed it was broken while testing it with a new test.jpg image.
* Merge branch 'ewlsh/update-eslint' into 'master'Philip Chimento2020-06-231-3/+3
|\ | | | | | | | | Update ESLint CI image. See merge request GNOME/gjs!451
| * Update dangling comma eslint rule.Evan Welsh2020-06-221-3/+3
| | | | | | | | - In ESLint v6, dangling commas on functions are now linted.
* | examples: add GListModel implementationAndy Holmes2020-06-211-0/+137
|/ | | | | | Add a simple implementation of GListModel, primarily as a demonstration of implementing interfaces in genera, but particularly this interface as it will be used quite a bit in Gtk4.
* GObject: Allow omitting setters and gettersPhilip Chimento2020-04-191-16/+1
| | | | | | | | | | | | | | | | | | | In the case where you don't need anything special from your GObject property getters and setters, just correct handling of notify signals and default values, it's now possible to leave out the getters and setters, and GJS will just do the right thing. This is convenient for JS code authors as well as avoiding problems caused by missing getters and setters. This only works for read-write properties. If a read-only or write-only property is missing its accessor, then one is generated which throws. If the property name consists of multiple words, then accessors will be generated for all three variants: kebab-case, snake_case, and camelCase. Additionally, if you do provide accessors for one of these, then they will be copied to the other two variants. See: #306
* examples: add a dbus-client and dbus-service exampleAndy Holmes2020-02-222-0/+304
|
* maint: Fix eslint errorsPhilip Chimento2020-02-011-3/+3
| | | | | Apparently eslint has fixed some oversights in its dangling comma detection.
* add websocket client exampleSonny Piers2019-09-201-0/+52
|
* add http client exampleSonny Piers2019-09-201-0/+53
|
* CI: Add space-before-function-paren to eslint rulesPhilip Chimento2019-08-131-1/+1
| | | | | | | | This is done quite inconsistently across the codebase, so we pick the most common style and enforce it. That is, no space before function parentheses, except in the case of anonymous functions and async arrow functions, where we add a space so as not to conflict with the rule of spaces around keywords.
* CI: Add no-trailing-spaces to eslint rulesPhilip Chimento2019-08-131-19/+19
| | | | | Some git clients or editors will enforce this anyway, and we don't want them to put spacing fixes in unrelated commits, so fix 'em all now.
* CI: Add no-shadow to eslint rulesPhilip Chimento2019-08-131-2/+2
| | | | | | | | | We have this compiler warning enabled for the C++ code, so we may as well have it for the JS code too. This one actually did catch a sort-of bug. Like some other rules where the fix isn't straightforward, we disable it for tweener.js.
* CI: Add no-extra-parens to eslint rulesPhilip Chimento2019-08-131-3/+2
| | | | | This improves readability, having lots of extra parentheses is hard on the eye.
* CI: Add func-style to eslint rulesPhilip Chimento2019-08-131-15/+33
| | | | | | function foo() { ... } is shorter than var foo = function() { ... };, and there's also less chance to have a discrepancy between the names of the function and the variable holding it.
* CI: Add func-call-spacing to eslint rulesPhilip Chimento2019-08-131-1/+1
| | | | | This rule was already observed almost everywhere so let's make it consistent.
* CI: Add eqeqeq to eslint rulesPhilip Chimento2019-08-132-3/+3
| | | | | | | Using == for comparisons is a well-known gotcha that we should avoid. However, we ignore the rule in tweener.js to reduce the risk of regressions in the unmaintained code.
* CI: Add curly to eslint rulesPhilip Chimento2019-08-133-13/+8
| | | | | | This allows omitting the braces on a one-line block (note one-statement is not necessarily one-line!) but enforces consistent brace style between if and else clauses which can be a source of bugs.
* CI: Add comma-dangle to eslint rulesPhilip Chimento2019-08-133-12/+12
| | | | This is useful for making diffs smaller and easier to read.
* CI: Use camelcasePhilip Chimento2019-08-132-67/+67
| | | | | | Use camelcase variables everywhere, but don't yet enable the rule for real; it hasn't been in eslint that long and not all distributions have caught up.
* js: Fix remaining eslint complaintsPhilip Chimento2019-08-131-7/+7
| | | | | Some of these show that there were rules active that we didn't really care about, so we disable those rules; others were fixed.
* js: Convert all tabs to spacesPhilip Chimento2019-08-131-2/+2
| | | | Use the no-tabs rule in eslint to enforce this in the future.
* examples: Fix deprecated ByteArray usagePhilip Chimento2018-11-031-1/+2
|
* examples: Fix some best practicesPhilip Chimento2018-08-094-12/+13
| | | | As discussed in the code review of !207.
* examples: fix eslint errorsClaudio André2018-08-098-65/+70
| | | | | Run `eslint --fix examples --format unix`. Examples don't have a real history, so that is acceptable.
* examples: fix a bug in webkit.jsClaudio André2018-07-181-0/+4
| | | | It was missing needed instructions.
* examples/calc: Update coding stylePhilip Chimento2018-04-231-79/+80
|
* make compatible with gjsWilliam Barath2018-04-231-13/+16
|
* Add calc.js from GNU SeedWilliam Barath2018-04-231-0/+137
|
* Remove unnecessary semicolonsPhilip Chimento2018-03-241-1/+1
| | | | | This intends to fix a few linter errors without affecting the ability to 'git blame' large sections of code.
* mv gtk-window.js to amend gtk.js, including suggestionsAndy Holmes2017-12-101-65/+67
|
* Amend gtk-application.jsAndy Holmes2017-12-101-0/+131
|
* repo: Warn when importing a namespace with >1 versionColin Walters2017-04-073-1/+4
| | | | | | | | | | | | | | | | | | | | In introspection, libraries are a pair of (namespace, version). But it's possible to request "the latest" version of a namespace, and this is in fact what many projects do. The problem is that for say GTK+ which has 2.0, 3.0, and is just releasing 4.0, most people's scripts imported gi.Gtk and expected to receive 3.0, and will explode when installing 4.0. Let's start warning about unversioned imports when there are multiple versions available, and get people to do: imports.gi.versions.Gtk = '3.0'; const Gtk = imports.gi.Gtk; (Original patch by Colin Walters; revised by Philip Chimento.) https://bugzilla.gnome.org/show_bug.cgi?id=689654
* js: Prefer bool to gbooleanPhilip Chimento2016-09-271-4/+4
| | | | | | | | | | | | | | | | Since we removed JSBool, JS_TRUE, and JS_FALSE in the previous commit, we now also make usage of gboolean, TRUE, and FALSE consistent. In some places, JSBool and gboolean were used interchangeably. Here, we take the approach of using C++ bool, true, and false everywhere, except when required by the API, e.g. for the return type of idle functions. In a few instances, TRUE and FALSE were used in comments in JS code; here we change those to true and false to avoid confusion. Fixes a few formatting glitches in lines of code that were touched anyway. https://bugzilla.gnome.org/show_bug.cgi?id=742249
* examples: Update WebKit exampleMichael Catanzaro2016-02-101-5/+2
|