Document
How to use the Document class of the bit Butil?
Usage
To use the browser document features you need to inject the Bit.Butil.Document class and use it like this:
@inject Bit.Butil.Document document
@code {
await document.AddEventListener(ButilEvents.Click, args => { ... });
await document.SetTitle("New shinny title");
}Methods
AddEventListener, RemoveEventListener:
Sets up a function that will be called whenever the specified event is delivered to the document (MDN).
GetCharacterSet:
Returns the character set being used by the document (MDN).
GetCompatMode:
Indicates whether the document is rendered in quirks or strict mode (MDN).
GetContentType:
Returns the Content-Type from the MIME Header of the current document (MDN).
GetDocumentURI:
Returns the document location as a string (MDN).
SetDesignMode, GetDesignMode:
Gets/Sets ability to edit the whole document (MDN).
@inject Bit.Butil.Document document
<BitCheckbox @bind-Value="isDesignModeOn" Label="@(isDesignModeOn ? "On" : "Off")" />
<BitButton OnClick=SetDesignMode>SetDesignMode</BitButton>
@code {
private bool isDesignModeOn;
private async Task SetDesignMode()
{
await document.SetDesignMode(isDesignModeOn ? DesignMode.On : DesignMode.Off);
}
}SetDir, GetDir:
Gets/Sets directionality (Rtl/Ltr) of the document (MDN).
SetTitle, GetTitle:
Gets/Sets the title of the current document (MDN).
GetReferrer:
Returns the URI of the page that linked to this page (MDN).
GetUrl:
Returns the document location as a string (MDN).
ExitFullscreen:
Stops document's fullscreen element from being displayed fullscreen (MDN).
ExitPointerLock:
Release the pointer lock (MDN).