Browse Source

feat: add label property to Display objects (#36932)

Co-authored-by: Milan Burda <[email protected]>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <[email protected]>
trop[bot] 2 years ago
parent
commit
72bdd5cd4c

+ 1 - 0
docs/api/structures/display.md

@@ -1,6 +1,7 @@
 # Display Object
 
 * `id` number - Unique identifier associated with the display.
+* `label` string - User-friendly label, determined by the platform.
 * `rotation` number - Can be 0, 90, 180, 270, represents screen rotation in
   clock-wise degrees.
 * `scaleFactor` number - Output device's pixel scale factor.

+ 1 - 0
shell/common/gin_converters/gfx_converter.cc

@@ -144,6 +144,7 @@ v8::Local<v8::Value> Converter<display::Display>::ToV8(
   gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
   dict.SetHidden("simple", true);
   dict.Set("id", val.id());
+  dict.Set("label", val.label());
   dict.Set("bounds", val.bounds());
   dict.Set("workArea", val.work_area());
   dict.Set("accelerometerSupport", val.accelerometer_support());

+ 1 - 0
spec/api-screen-spec.ts

@@ -34,6 +34,7 @@ describe('screen module', () => {
 
       expect(display).to.have.property('scaleFactor').that.is.a('number');
       expect(display).to.have.property('id').that.is.a('number');
+      expect(display).to.have.property('label').that.is.a('string');
       expect(display).to.have.property('rotation').that.is.a('number');
       expect(display).to.have.property('touchSupport').that.is.a('string');
       expect(display).to.have.property('accelerometerSupport').that.is.a('string');