@owe/core

Module: @owe/core

(require("@owe/core"))(object, binding, typeopt) → {object}

Binds the given object to a binding object that wraps a router and/or closer function. This usually is the preferred way to call this function.

Parameters
Name Type Attributes Default Description
object object

The object that should be bound.

binding object

An object containing a router and closer function.

Properties
Name Type Attributes Description
router function <optional>

The router that should be used.

closer function <optional>

The closer that should be used.

type Binding.type | string <optional>
"normal"

The way object should be bound. Valid values are "normal", "rebind", "clone" or their respective symbol representations found in Binding.types.

Returns

The object that was bound. If type was "clone" the bound cloned object is returned, object elsewise.

Type
object

(require("@owe/core"))(object, routernullable, closernullable, typeopt) → {object}

Binds the given object to a router and closer function.

Parameters
Name Type Attributes Default Description
object object

The object that should be bound.

router function <nullable>

The router that should be used.

closer function <nullable>

The closer that should be used.

type Binding.type | string <optional>
"normal"

The way object should be bound. Valid values are "normal", "rebind", "clone" or their respective symbol representations found in Binding.types.

Returns

The object that was bound. If type was "clone" the bound cloned object is returned, object elsewise.

Type
object

Members

(inner) Binding

A reference to the Binding class.

(inner) client

A reference to the client module.

(inner) expose

A reference to the expose module.

(inner) exposed

A reference to the expose module.

(inner) proxify

A reference to the proxify function.

(inner) resource

A reference to the resource module.

(inner) State

A reference to the State class.

(inner) unproxify

An alias for the proxify.revert function.

Methods

module:@owe/core(object, binding, typeopt) → {object}

Binds the given object to a binding object that wraps a router and/or closer function. This usually is the preferred way to call this function.

Parameters
Name Type Attributes Default Description
object object

The object that should be bound.

binding object

An object containing a router and closer function.

Properties
Name Type Attributes Description
router function <optional>

The router that should be used.

closer function <optional>

The closer that should be used.

type Binding.type | string <optional>
"normal"

The way object should be bound. Valid values are "normal", "rebind", "clone" or their respective symbol representations found in Binding.types.

Returns

The object that was bound. If type was "clone" the bound cloned object is returned, object elsewise.

Type
object

module:@owe/core(object, routernullable, closernullable, typeopt) → {object}

Binds the given object to a router and closer function.

Parameters
Name Type Attributes Default Description
object object

The object that should be bound.

router function <nullable>

The router that should be used.

closer function <nullable>

The closer that should be used.

type Binding.type | string <optional>
"normal"

The way object should be bound. Valid values are "normal", "rebind", "clone" or their respective symbol representations found in Binding.types.

Returns

The object that was bound. If type was "clone" the bound cloned object is returned, object elsewise.

Type
object

(inner) api(object, router, closer, typeopt) → {Api}

Behaves like the @owe/core function but returns an Api instead of the given object. If object is already bound, router, closer and type are optional and api() simply returns an Api instance for the given object.

Parameters
Name Type Attributes Default Description
object object

The object that should be bound.

router function

The router that should be used.

closer function

The closer that should be used.

type Binding.type | string <optional>
Binding.types.normal

The way object should be bound. Valid values are "normal", "rebind", "clone" or their respective symbol representations found in Binding.types.

Returns

An Api instance for object.

Type
Api

(inner) isApi(api) → {boolean}

Returns whether the given object is an Api instance.

Parameters
Name Type Description
api any

The api to check. This can be any value. The method will always return false for non-objects.

Returns

true if api is an Api. false if not.

Type
boolean

(inner) isBound()

Checks whether a given object is bound.

(inner) isExposed()

Checks whether a given object is exposed.