pub struct Options { /* private fields */ }Expand description
Window open options
Implementations§
source§impl Options
impl Options
sourcepub fn id(self, id: &str) -> Options
pub fn id(self, id: &str) -> Options
the id used to identify the window. This will be used to remember the size and position of the window and restore that geometry when a window with the same id is later opened. See also the Chrome App documentation ⧉ NWJS Documentation
sourcepub fn title(self, title: &str) -> Options
pub fn title(self, title: &str) -> Options
The default title of window created by NW.js, . it’s very useful if you want to show your own title when the app is starting
sourcepub fn position(self, position: WindowPosition) -> Options
pub fn position(self, position: WindowPosition) -> Options
Move window to specified position. Currently only center is supported on all platforms, which will put window in the middle of the screen.
There are three valid positions: null or center or mouse
sourcepub fn min_height(self, min_height: u32) -> Options
pub fn min_height(self, min_height: u32) -> Options
minimum inner height of window
sourcepub fn max_height(self, max_height: u32) -> Options
pub fn max_height(self, max_height: u32) -> Options
maximum inner height of window
sourcepub fn as_desktop(self, as_desktop: bool) -> Options
pub fn as_desktop(self, as_desktop: bool) -> Options
(Linux) show as desktop background window under X11 environment
sourcepub fn always_on_top(self, always_on_top: bool) -> Options
pub fn always_on_top(self, always_on_top: bool) -> Options
whether the window should always stay on top of other windows.
sourcepub fn visible_on_all_workspaces(
self,
visible_on_all_workspaces: bool
) -> Options
pub fn visible_on_all_workspaces( self, visible_on_all_workspaces: bool ) -> Options
whether the window should be visible on all workspaces simultaneously (on platforms that support multiple workspaces, currently Mac OS X and Linux).
sourcepub fn fullscreen(self, fullscreen: bool) -> Options
pub fn fullscreen(self, fullscreen: bool) -> Options
whether window is fullscreen
Beware, if frame is also set to false in fullscreen it will prevent the mouse from being captured on the very edges of the screen. You should avoid activate it if fullscreen is also set to true.
sourcepub fn show_in_taskbar(self, show_in_taskbar: bool) -> Options
pub fn show_in_taskbar(self, show_in_taskbar: bool) -> Options
whether the window is shown in taskbar or dock. The default is true.
sourcepub fn frame(self, frame: bool) -> Options
pub fn frame(self, frame: bool) -> Options
specify it to false to make the window frameless
Beware, if frame is set to false in fullscreen it will prevent the mouse from being captured on the very edges of the screen. You should avoid activating it if fullscreen is also set to true.
Frameless apps do not have a title bar for the user to click and drag the window. You can use CSS to designate DOM elements as draggable regions.
.drag-enable {
-webkit-app-region: drag;
}
.drag-disable {
-webkit-app-region: no-drag;
}
sourcepub fn show(self, show: bool) -> Options
pub fn show(self, show: bool) -> Options
specify it to false if you want your app to be hidden on startup
sourcepub fn kiosk(self, kiosk: bool) -> Options
pub fn kiosk(self, kiosk: bool) -> Options
whether to use Kiosk mode. In Kiosk mode, the app will be fullscreen
and try to prevent users from leaving the app, so you should
remember to provide a way in app to leave Kiosk mode.
This mode is mainly used for presentation on public displays
sourcepub fn transparent(self, transparent: bool) -> Options
pub fn transparent(self, transparent: bool) -> Options
whether to turn on transparent window mode.
The default is false.
Control the transparency with rgba background value in CSS.
Use command line option --disable-transparency to disable this
feature completely.
There is experimental support for “click-through” on the
transparent region: add --disable-gpu option to the command line.
sourcepub fn new_instance(self, value: bool) -> Options
pub fn new_instance(self, value: bool) -> Options
whether to open a new window in a separate render process.
sourcepub fn mixed_context(self, value: bool) -> Options
pub fn mixed_context(self, value: bool) -> Options
If true, the Node context and DOM context are merged in the new window’s process. Use only when new_instance is true.
sourcepub fn inject_js_start(self, js: &str) -> Options
pub fn inject_js_start(self, js: &str) -> Options
the script to be injected before any DOM is constructed and any script is run.
sourcepub fn inject_js_end(self, js: &str) -> Options
pub fn inject_js_end(self, js: &str) -> Options
the script to be injected after the document object is loaded, before onload event is fired.
Methods from Deref<Target = Object>§
sourcepub fn constructor(&self) -> Function
pub fn constructor(&self) -> Function
The constructor property returns a reference to the Object constructor
function that created the instance object.
sourcepub fn has_own_property(&self, property: &JsValue) -> bool
pub fn has_own_property(&self, property: &JsValue) -> bool
The hasOwnProperty() method returns a boolean indicating whether the
object has the specified property as its own property (as opposed to
inheriting it).
sourcepub fn is_prototype_of(&self, value: &JsValue) -> bool
pub fn is_prototype_of(&self, value: &JsValue) -> bool
The isPrototypeOf() method checks if an object exists in another
object’s prototype chain.
sourcepub fn property_is_enumerable(&self, property: &JsValue) -> bool
pub fn property_is_enumerable(&self, property: &JsValue) -> bool
The propertyIsEnumerable() method returns a Boolean indicating
whether the specified property is enumerable.
sourcepub fn to_locale_string(&self) -> JsString
pub fn to_locale_string(&self) -> JsString
The toLocaleString() method returns a string representing the object.
This method is meant to be overridden by derived objects for
locale-specific purposes.
sourcepub fn to_string(&self) -> JsString
pub fn to_string(&self) -> JsString
The toString() method returns a string representing the object.
Methods from Deref<Target = JsValue>§
pub const NULL: JsValue = _
pub const UNDEFINED: JsValue = _
pub const TRUE: JsValue = _
pub const FALSE: JsValue = _
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns the f64 value of this JS value if it’s an instance of a
number.
If this JS value is not an instance of a number then this returns
None.
sourcepub fn as_string(&self) -> Option<String>
pub fn as_string(&self) -> Option<String>
If this JS value is a string value, this function copies the JS string
value into wasm linear memory, encoded as UTF-8, and returns it as a
Rust String.
To avoid the copying and re-encoding, consider the
JsString::try_from() function from js-sys
instead.
If this JS value is not an instance of a string or if it’s not valid
utf-8 then this returns None.
UTF-16 vs UTF-8
JavaScript strings in general are encoded as UTF-16, but Rust strings
are encoded as UTF-8. This can cause the Rust string to look a bit
different than the JS string sometimes. For more details see the
documentation about the str type which contains a few
caveats about the encodings.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns the bool value of this JS value if it’s an instance of a
boolean.
If this JS value is not an instance of a boolean then this returns
None.
sourcepub fn is_undefined(&self) -> bool
pub fn is_undefined(&self) -> bool
Tests whether this JS value is undefined
sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Tests whether the type of this JS value is function.
sourcepub fn js_in(&self, obj: &JsValue) -> bool
pub fn js_in(&self, obj: &JsValue) -> bool
Applies the binary in JS operator on the two JsValues.
sourcepub fn loose_eq(&self, other: &JsValue) -> bool
pub fn loose_eq(&self, other: &JsValue) -> bool
Compare two JsValues for equality, using the == operator in JS.
sourcepub fn unsigned_shr(&self, rhs: &JsValue) -> u32
pub fn unsigned_shr(&self, rhs: &JsValue) -> u32
Applies the binary >>> JS operator on the two JsValues.
sourcepub fn checked_div(&self, rhs: &JsValue) -> JsValue
pub fn checked_div(&self, rhs: &JsValue) -> JsValue
Applies the binary / JS operator on two JsValues, catching and returning any RangeError thrown.
sourcepub fn pow(&self, rhs: &JsValue) -> JsValue
pub fn pow(&self, rhs: &JsValue) -> JsValue
Applies the binary ** JS operator on the two JsValues.
sourcepub fn lt(&self, other: &JsValue) -> bool
pub fn lt(&self, other: &JsValue) -> bool
Applies the binary < JS operator on the two JsValues.
sourcepub fn le(&self, other: &JsValue) -> bool
pub fn le(&self, other: &JsValue) -> bool
Applies the binary <= JS operator on the two JsValues.
sourcepub fn ge(&self, other: &JsValue) -> bool
pub fn ge(&self, other: &JsValue) -> bool
Applies the binary >= JS operator on the two JsValues.
sourcepub fn gt(&self, other: &JsValue) -> bool
pub fn gt(&self, other: &JsValue) -> bool
Applies the binary > JS operator on the two JsValues.
sourcepub fn unchecked_into_f64(&self) -> f64
pub fn unchecked_into_f64(&self) -> f64
Applies the unary + JS operator on a JsValue. Can throw.
Trait Implementations§
source§impl FromWasmAbi for Options
impl FromWasmAbi for Options
source§impl<'a> IntoWasmAbi for &'a Options
impl<'a> IntoWasmAbi for &'a Options
source§impl IntoWasmAbi for Options
impl IntoWasmAbi for Options
source§impl JsCast for Options
impl JsCast for Options
source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
instanceof check to see whether the JsValue
provided is an instance of this type. Read moresource§fn unchecked_from_js(val: JsValue) -> Options
fn unchecked_from_js(val: JsValue) -> Options
source§fn unchecked_from_js_ref(val: &JsValue) -> &Options
fn unchecked_from_js_ref(val: &JsValue) -> &Options
source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere
T: JsCast,
T. Read moresource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
T. Read moresource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
T. Read moresource§fn unchecked_into<T>(self) -> Twhere
T: JsCast,
fn unchecked_into<T>(self) -> Twhere
T: JsCast,
source§fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: JsCast,
source§impl LongRefFromWasmAbi for Options
impl LongRefFromWasmAbi for Options
§type Abi = <JsValue as LongRefFromWasmAbi>::Abi
type Abi = <JsValue as LongRefFromWasmAbi>::Abi
RefFromWasmAbi::Abisource§unsafe fn long_ref_from_abi(
js: <Options as LongRefFromWasmAbi>::Abi
) -> <Options as LongRefFromWasmAbi>::Anchor
unsafe fn long_ref_from_abi( js: <Options as LongRefFromWasmAbi>::Abi ) -> <Options as LongRefFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abisource§impl OptionFromWasmAbi for Options
impl OptionFromWasmAbi for Options
source§impl<'a> OptionIntoWasmAbi for &'a Options
impl<'a> OptionIntoWasmAbi for &'a Options
source§impl OptionIntoWasmAbi for Options
impl OptionIntoWasmAbi for Options
source§impl OptionsTrait for Options
impl OptionsTrait for Options
source§impl PartialEq for Options
impl PartialEq for Options
source§impl RefFromWasmAbi for Options
impl RefFromWasmAbi for Options
§type Abi = <JsValue as RefFromWasmAbi>::Abi
type Abi = <JsValue as RefFromWasmAbi>::Abi
Self are recovered from.§type Anchor = ManuallyDrop<Options>
type Anchor = ManuallyDrop<Options>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.source§unsafe fn ref_from_abi(
js: <Options as RefFromWasmAbi>::Abi
) -> <Options as RefFromWasmAbi>::Anchor
unsafe fn ref_from_abi( js: <Options as RefFromWasmAbi>::Abi ) -> <Options as RefFromWasmAbi>::Anchor
impl Eq for Options
impl Send for Options
impl StructuralEq for Options
impl StructuralPartialEq for Options
impl Sync for Options
Auto Trait Implementations§
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abisource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.