Skip to content

Commit

Permalink
[update] detach added, configuration updated
Browse files Browse the repository at this point in the history
  • Loading branch information
tbshag2 committed Oct 7, 2024
1 parent 69d5d0a commit 5178bf3
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
56 changes: 56 additions & 0 deletions docs/api/internal/booking-detach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
sidebar_label: api.detach()
title: detach Method
description: You can learn about the detach method in the documentation of the DHTMLX JavaScript Booking library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Booking.
---

# api.detach()

## Description

Allows removing/detaching event handlers

## Usage

~~~jsx {}
api.detach(tag: number | string ): void;
~~~

## Parameters

- `tag` - the name of the action tag

## Example

In the example below we add an object with the **tag** property to the [`api.on()`](/api/internal/booking-on) handler, and then we use the `api.detach()` method to stop logging the [`open-filter`](/api/events/booking-selectslot-event) event.

~~~jsx {5-19}
const widget = new booking.Booking("#root", {
data,
//other configuration parameters
});

// add handler
if (booking.api) {
booking.api.on(
"select-slot",
({ id }) => {
console.log("Selected: " + id);
},
{ tag: "track" }
);
}

// detach handler
function stop() {
booking.api.detach("track");
}

const button = document.createElement("button");

button.addEventListener("click", stop);
button.textContent = "Stop logging";

document.body.appendChild(button);

~~~
2 changes: 1 addition & 1 deletion docs/api/overview/booking-events-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: You can have an API overview of JavaScript Booking in the documenta

| Name | Description |
| ----------------------------------------- | ------------------------------------------------ |
| [](..events/booking-confirmslot-event.md) | @getshort(../events/booking-confirmslot-event.md) |
| [](../events/booking-confirmslot-event.md) | @getshort(../events/booking-confirmslot-event.md) |
| [](../events/booking-filterdata-event.md) | @getshort(../events/booking-filterdata-event.md) |
| [](../events/booking-selectitem-event.md) | @getshort(../events/booking-selectitem-event.md) |
| [](../events/booking-selectitemdate-event.md) | @getshort(../events/booking-selectitemdate-event.md) |
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ new booking.Booking("#root", {

### Enabling the autoApply mode for the filter

To hide the **Search** button and make the filter apply right after a user's input, set the `autoApply` parameter of the [`filterShape`](/api/config/booking-filterShape) property to **true**.
To hide the **Search** button and make the filter immediately apply a user's input, set the `autoApply` parameter of the [`filterShape`](/api/config/booking-filterShape) property to **true**.

Example:

Expand Down
10 changes: 10 additions & 0 deletions docs/news/whats_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ description: SEO data
---

# What's new

## Version 1.0.0

### Initial functionality

- Configurable cards with data
- Configurable fields and data displayed in the Booking dialog
- Configurable slot duration and gap between slots
- Configurable filter
- Localization

0 comments on commit 5178bf3

Please sign in to comment.