This commit is contained in:
David Štaleker
2025-07-18 05:33:16 +02:00
parent 401a367e5d
commit db0cc8d3de
14776 changed files with 9251484 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
## get ➡ ( path, value )
Triggered before a `.get()` (or any alias) return. The triggered listener receives the normalized *path* and the *value* found.
| Parameter | Description |
| --- | --- |
| *path* | See [../core/get.md](.get()) for more information |
| *value* | See [../core/get.md](.get()) for more information |
See [Cldr.on()](global_on.md) or [.on()](on.md) for example.

View File

@@ -0,0 +1,10 @@
## Cldr.off( event, listener )
Removes a listener function from the specified event globally (for all instances).
| Parameter | Type | Example |
| --- | --- | --- |
| *event* | String | `"get"` |
| *listener* | Function | |
See [Cldr.on()](global_on.md) for example.

View File

@@ -0,0 +1,32 @@
## Cldr.on( event, listener )
Add a listener function to the specified event globally (for all instances).
| Parameter | Type | Example |
| --- | --- | --- |
| *event* | String | `"get"` |
| *listener* | Function | |
```javascript
Cldr.load({
foo: "bar"
});
function log( path, value ) {
console.log( "Got", path, value );
}
Cldr.on( "get", log );
en = new Cldr( "en" );
en.get( "foo" );
// Got foo bar (logged)
// ➡ bar
zh = new Cldr( "zh" );
zh.get( "foo" );
// Got foo bar (logged)
// ➡ bar
Cldr.off( "get", log );
```

View File

@@ -0,0 +1,28 @@
## Cldr.once( event, listener )
Add a listener function to the specified event globally (for all instances). It will be automatically removed after it's first execution.
| Parameter | Type | Example |
| --- | --- | --- |
| *event* | String | `"get"` |
| *listener* | Function | |
```javascript
Cldr.load({
foo: "bar"
});
function log( path, value ) {
console.log( "Got", path, value );
}
Cldr.once( "get", log );
cldr = new Cldr( "en" );
cldr.get( "foo" );
// Got foo bar (logged)
// ➡ bar
cldr.get( "foo" );
// ➡ bar
```

View File

@@ -0,0 +1,10 @@
## .off( event, listener )
Removes a listener function from the specified event for this instance.
| Parameter | Type | Example |
| --- | --- | --- |
| *event* | String | `"get"` |
| *listener* | Function | |
See [cldr.on()](on.md) for example.

View File

@@ -0,0 +1,26 @@
## .on( event, listener )
Add a listener function to the specified event for this instance.
| Parameter | Type | Example |
| --- | --- | --- |
| *event* | String | `"get"` |
| *listener* | Function | |
```javascript
Cldr.load({
foo: "bar"
});
function log( path, value ) {
console.log( "Got", path, value );
}
cldr = new Cldr( "en" );
cldr.on( "get", log );
cldr.get( "foo" );
// Got foo bar (logged)
// ➡ bar
cldr.off( "get", log );
```

View File

@@ -0,0 +1,27 @@
## .once( event, listener )
Add a listener function to the specified event for this instance. It will be automatically removed after it's first execution.
| Parameter | Type | Example |
| --- | --- | --- |
| *event* | String | `"get"` |
| *listener* | Function | |
```javascript
Cldr.load({
foo: "bar"
});
function log( path, value ) {
console.log( "Got", path, value );
}
cldr = new Cldr( "en" );
cldr.once( "get", log );
cldr.get( "foo" );
// Got foo bar (logged)
// ➡ bar
cldr.get( "foo" );
// ➡ bar
```