# BaseProfile

`com.jsmacrosce.jsmacros.core.config.BaseProfile`

**Since:** 1.2.7

Manages a core's active profile and the event and library registries initialized for it.

## Constructors

### new BaseProfile {#com.jsmacrosce.jsmacros.core.config.BaseProfile_constructor-Core-Logger-}

```js
new BaseProfile(Core runner, Logger logger)
```

Stores the supplied core and logger references; registry setup and profile loading are performed by `init(String)`.

**Parameters:**
- `runner`: core associated with this profile
- `logger`: logger for profile diagnostics

## Fields

### joinedThreadStack {#com.jsmacrosce.jsmacros.core.config.BaseProfile_joinedThreadStack}

```js
joinedThreadStack: Set<Thread>
```

Threads joined during joined-main event dispatch, removed after their callbacks are awaited or interrupted.  
This mutable set is neither a thread stack nor a record of all running threads.

### LOGGER {#com.jsmacrosce.jsmacros.core.config.BaseProfile_LOGGER}

```js
LOGGER: Logger
```

Logger supplied for this profile's diagnostics.

### profileName {#com.jsmacrosce.jsmacros.core.config.BaseProfile_profileName}

```js
profileName: String
```

Current profile name, or `null` until one is assigned; this name is used as the save key.

### runner {#com.jsmacrosce.jsmacros.core.config.BaseProfile_runner}

```js
runner: Core<?, ?>
```

Core associated with this profile.

## Methods

### checkJoinedThreadStack {#com.jsmacrosce.jsmacros.core.config.BaseProfile_checkJoinedThreadStack-}

```js
checkJoinedThreadStack(): boolean
```

Reports whether the current thread's joined-event stack permits joined dispatch.

**Returns:** `true` if joined dispatch is permitted for the current thread

**Since:** 1.6.0

### getCurrentProfileName {#com.jsmacrosce.jsmacros.core.config.BaseProfile_getCurrentProfileName-}

```js
getCurrentProfileName(): String
```

Returns the current stored profile name.

**Returns:** current name, or `null` before one is assigned

### init {#com.jsmacrosce.jsmacros.core.config.BaseProfile_init-String-}

```js
init(String defaultProfile): void
```

Initializes registries, then loads or creates the default profile.

**Parameters:**
- `defaultProfile`: name of the profile to load or create

### loadOrCreateProfile {#com.jsmacrosce.jsmacros.core.config.BaseProfile_loadOrCreateProfile-String-}

```js
loadOrCreateProfile(String profileName): void
```

Loads the named profile, creating and persisting an empty profile when its name is absent from configuration.

**Parameters:**
- `profileName`: name of the profile to load or create

**Since:** 1.0.9

### logError {#com.jsmacrosce.jsmacros.core.config.BaseProfile_logError-Throwable-}

```js
logError(Throwable ex): void
```

Reports a failure through this profile's error-handling implementation.

**Parameters:**
- `ex`: failure to report

### renameCurrentProfile {#com.jsmacrosce.jsmacros.core.config.BaseProfile_renameCurrentProfile-String-}

```js
renameCurrentProfile(String profile): void
```

Assigns the current profile name without renaming a configured profile entry or persisting configuration.

**Parameters:**
- `profile`: new current profile name

### saveProfile {#com.jsmacrosce.jsmacros.core.config.BaseProfile_saveProfile-}

```js
saveProfile(): void
```

Saves the registered script triggers under the current profile name and persists the configuration.

**Since:** 1.0.0

### triggerEvent {#com.jsmacrosce.jsmacros.core.config.BaseProfile_triggerEvent-BaseEvent-}

```js
triggerEvent(BaseEvent event): void
```

Dispatches an event to its named listeners and, unless ignored, to `ANYTHING` listeners.  
A listener is joined only when it requests joined handling and the event permits joining;  
joined callbacks are awaited. A listener that does not request joining receives a read-only
delivery that dispatch does not wait for and cannot change the event.

**Parameters:**
- `event`: event to dispatch

**Since:** 1.2.7
