最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

gnome - Lang.Class in Javascript - Stack Overflow

programmeradmin5浏览0评论

I'm trying to develop an Gnome Shell extension using GJS(Gnome Javascript), however, I came across the Lang library (I think it is a library, if not correct me). But I can't find any resources about it on the web.

In the code it looks something like this:

const Lang = imports.lang;

const ObjectA = new Lang.Class({ ... });

Where can I find some documentation about it? Is it a Gnome lib? A Mozilla lib?

I'm trying to develop an Gnome Shell extension using GJS(Gnome Javascript), however, I came across the Lang library (I think it is a library, if not correct me). But I can't find any resources about it on the web.

In the code it looks something like this:

const Lang = imports.lang;

const ObjectA = new Lang.Class({ ... });

Where can I find some documentation about it? Is it a Gnome lib? A Mozilla lib?

Share Improve this question asked Mar 19, 2014 at 6:28 Ángel ArayaÁngel Araya 2351 silver badge8 bronze badges 1
  • FYI for future wanderers, Lang is deprecated now that we have native es6 classes, etc. More info here. – mgalgs Commented Oct 17, 2023 at 17:39
Add a ment  | 

1 Answer 1

Reset to default 9

It's a built-in module of gjs -- see modules/lang.js. It includes two main things: bind() (a helper to make "this" point to the logical object in closures) and Class, which basically implements a class in a language that does not have the concept of classes... It would be hard to work with GObject (a class-based object system) without this.

发布评论

评论列表(0)

  1. 暂无评论