• Avi's avatar
    Added _promisify to GJS GIO overrides · decae6d1
    Avi authored
    The _promisify function is a new internal feature for GJS, providing
    developers the option to write asynchronous operations with either
    the original callbacks from GNOME's original C (using GObject)
    libraries or to write them using async/await, a new modern way to
    write asynchronous code in JavaScript. This feature hides all of the
    original callbacks from developers in a Promise, allowing one to call
    the _async function like a variable by calling it with await in an async
    function. This is a backwards compatible feature, thus it will not
    impact already existing code using callbacks.
    
    Please note that if you use this feature, to be ready for the official
    API version coming out in 3.32 where slight changes to your code will
    be necessary (in a good way, you can remove an extra line or two of
    your code)!
    
    To use this feature, instead of nesting your _async and _finish function
    in your code (e.g. load_contents_async, load_contents_finish), you can
    update your program to an "async function", and call the _async function
    with an await leading it. You will also need to call the feature in your
    program, too, until the 3.32 release.
    
    Example:
    Gio._promisify(..., 'load_contents_async', 'load_contents_finish');
    let [raw_content] = file.load_contents_async(cancellable);
    decae6d1
Name
Last commit
Last update
doc Loading commit data...
examples Loading commit data...
gi Loading commit data...
gjs Loading commit data...
installed-tests Loading commit data...
libgjs-private Loading commit data...
m4 Loading commit data...
modules Loading commit data...
test Loading commit data...
tools Loading commit data...
util Loading commit data...
win32 Loading commit data...
.clang-format Loading commit data...
.eslintignore Loading commit data...
.eslintrc.json Loading commit data...
.gitlab-ci.yml Loading commit data...
AUTHORS Loading commit data...
COPYING Loading commit data...
COPYING.LGPL Loading commit data...
CPPLINT.cfg Loading commit data...
ChangeLog Loading commit data...
Makefile-examples.am Loading commit data...
Makefile-insttest.am Loading commit data...
Makefile-modules.am Loading commit data...
Makefile-test.am Loading commit data...
Makefile.am Loading commit data...
NEWS Loading commit data...
README Loading commit data...
README.md Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
git.mk Loading commit data...
gjs-1.0.pc.in Loading commit data...
gjs-modules-srcs.mk Loading commit data...
gjs-srcs.mk Loading commit data...
gjs.doap Loading commit data...
verbump.py Loading commit data...