module:nmodule/export/rc/ExportDestinationType

module:nmodule/export/rc/ExportDestinationType

API Status: Development

A destination type describes where a transform operation may send its output.
Examples include: the file system; the clipboard; the cloud; an external
application.

When sending transformed data to a destination, there are three touchpoints
in that workflow:

  • checkValid(): does this destination even work? Example: a destination
    that sends data to the clipboard is not valid in a browser that does not
    support the Clipboard API, so don't even present it to the user as an
    option.
  • prepare(): does this destination work for the transform as requested
    by the user? Example: a destination that writes to the file system would
    prompt the user to make sure it's okay to overwrite a particular file.
  • transform(): All systems go - write the data.

Constructor

(abstract) new (require("nmodule/export/rc/ExportDestinationType"))()

Source:

Methods

checkValid()

Source:
Throws:

if this destination is not valid in the current environment

Type
Error

getDestinationConfig(transformOp) → {baja.Component|Promise.<(baja.Component|undefined)>|undefined}

Description:
  • When invoking a transform operation using the Export Dialog, options can
    be provided by the user to configure how to send the transformed data to
    its destination.

    If this destination should provide user-configurable options, override
    this function to provide them in the form of a Component. This
    Component will be shown to the user in a Property Sheet for
    configuration.

Source:
Parameters:
Name Type Description
transformOp module:nmodule/export/rc/TransformOperation

The transform operation this destination type is a target for

Returns:

The destination config object.

Type
baja.Component | Promise.<(baja.Component|undefined)> | undefined

getDestinationContextObject(config) → {object|Promise.<object>}

Description:
  • When the user invokes the transform, the Component as edited by the
    user will need to be converted to a context object to be used in the
    transform() method. This function provides a hook to perform extra
    processing during that conversion.

    By default, will return a simple mapping of the Component's slot names
    to their values.

Source:
Parameters:
Name Type Description
config baja.Component

The destination config component as edited by the user

Returns:

the context object

Type
object | Promise.<object>

(abstract) getDisplayName() → {string}

Source:
Returns:

display name for the destination

Type
string

prepare(transformOp, cx) → {Promise.<boolean>|boolean}

Description:
  • Perform any necessary preparation before the actual transform. This is a
    hook for things like user prompts ("do you want to overwrite this file?",
    etc). By default, simply returns true.

Source:
Parameters:
Name Type Description
transformOp module:nmodule/export/rc/TransformOperation

the transform operation

cx object

the export context

Returns:

return or resolve true to indicate
that the transform should proceed. Return false to indicate that the
transform was canceled (either by the user, or conditions simply do not
support this transform/destination). Throw or reject only in case of an
unexpected error condition.

Type
Promise.<boolean> | boolean

(abstract) transform(transformOp, cx) → {Promise|*}

Description:
  • Perform the entire transformation operation: execute the transform
    to obtain the transformed data, and send that data to this destination.

    Important note: this method should not require any user interaction.
    It should only be data-in to data-out. Any user prompts should be
    completed in prepare().

Source:
Parameters:
Name Type Description
transformOp module:nmodule/export/rc/TransformOperation

the transform operation

cx object

the export context

Returns:
Type
Promise | *