Commit a129cce2 authored by Avi's avatar Avi

Updated parameters with ...args to make it more generic

parent d3346038
......@@ -5,9 +5,9 @@ let loop = GLib.MainLoop.new(null, false);
/* This is a workaround for now */
const Gio_File_prototype = Gio.File.new_for_path('').constructor.prototype;
Gio_File_prototype.load_contents_promise = function(cancellable=null){
Gio_File_prototype.load_contents_promise = function(...args){
return new Promise((resolve, reject)=>{
this.load_contents_async(cancellable, function(f, res) {
this.load_contents_async(...args, function(f, res) {
try {
let result = f.load_contents_finish(res);
resolve(result);
......@@ -36,8 +36,8 @@ const head = async(filename)=>{
let file = Gio.file_new_for_commandline_arg(filename);
let content_formatted;
try {
/* To cancel the operation add the 'cancel' param */
let [, raw_content] = await file.load_contents_promise(/* cancel */);
/* To cancel the operation toggle the 'null' with the 'cancel' param */
let [, raw_content] = await file.load_contents_promise(null/*cancel*/);
content_formatted = raw_content.toString();
print(content_formatted.split('\n', 10).join('\n'));
} catch (error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment