Hierarchy

Constructors

Properties

attributes: Partial<any>
changed: Partial<any>
cid: string
cidPrefix: string
collection: Collection<DOMWidgetModel>
id: string | number
idAttribute: string
model_id: string
module: string
name: string
state_change: Promise<any>
url: (() => string)

Type declaration

    • (): string
    • Returns the relative URL where the model's resource would be located on the server.

      Returns string

urlRoot: _Result<string>
validationError: any
views?: {
    [key: string]: Promise<WidgetView>;
}

Type declaration

widget_manager: IWidgetManager
serializers: ISerializers = ...

Accessors

Methods

  • Parameters

    • eventName: string
    • callback: EventHandler
    • Optional context: any

    Returns DOMWidgetModel

  • Parameters

    • eventMap: EventMap
    • Optional context: any

    Returns DOMWidgetModel

  • Returns any

  • Return an object containing all the attributes that have changed, or false if there are no changed attributes. Useful for determining what parts of a view need to be updated and/or what attributes need to be persisted to the server. Unset attributes will be set to undefined. You can also pass an attributes object to diff against the model, determining if there would be a change.

    Parameters

    • Optional attributes: Partial<any>

    Returns false | Partial<any>

  • Returns Model<any, ModelSetOptions, any>

  • Close model

    Returns

    • a promise that is fulfilled when all the associated views have been removed.

    Parameters

    • comm_closed: boolean = false

      true if the comm is already being closed. If false, the comm will be closed.

    Returns Promise<void>

  • Parameters

    • Optional options: ModelDestroyOptions

    Returns false | JQueryXHR

  • Parameters

    • attribute: string

    Returns string

  • Parameters

    • Optional options: ModelFetchOptions

    Returns JQueryXHR

  • For strongly-typed access to attributes, use the get method only privately in public getter properties.

    Example

    get name(): string {
    return super.get("name");
    }

    Type Parameters

    • A extends string

    Parameters

    • attributeName: A

    Returns any

  • Get the serializable state of the model.

    If drop_default is truthy, attributes that are equal to their default values are dropped.

    Parameters

    • Optional drop_defaults: boolean

    Returns JSONObject

  • Parameters

    • attribute: string

    Returns boolean

  • Parameters

    • Optional attribute: string

    Returns boolean

  • Returns any

  • Returns boolean

  • Parameters

    • Optional options: any

    Returns boolean

  • Returns string[]

  • Parameters

    • attrs: any

    Returns boolean

  • Parameters

    • Optional eventName: null | string
    • Optional callback: null | EventHandler
    • Optional context: any

    Returns DOMWidgetModel

  • Type Parameters

    • A extends string

    Parameters

    • keys: A[]

    Returns Partial<_Omit<any, A>>

  • Type Parameters

    • A extends string

    Parameters

    • Rest ...keys: A[]

    Returns Partial<_Omit<any, A>>

  • Parameters

    • fn: ((value: any, key: any, object: any) => any)
        • (value: any, key: any, object: any): any
        • Parameters

          • value: any
          • key: any
          • object: any

          Returns any

    Returns Partial<any>

  • Parameters

    • eventName: string
    • callback: EventHandler
    • Optional context: any

    Returns DOMWidgetModel

  • Parameters

    • eventMap: EventMap
    • Optional context: any

    Returns DOMWidgetModel

  • on_some_change(['key1', 'key2'], foo, context) differs from on('change:key1 change:key2', foo, context). If the widget attributes key1 and key2 are both modified, the second form will result in foo being called twice while the first will call foo only once.

    Parameters

    • keys: string[]
    • callback: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • context: any

    Returns void

  • Parameters

    • events: string
    • callback: EventHandler
    • Optional context: any

    Returns DOMWidgetModel

  • Parameters

    • eventMap: EventMap
    • Optional context: any

    Returns DOMWidgetModel

  • Returns any[]

  • Parameters

    • response: any
    • Optional options: any

    Returns any

  • Type Parameters

    • A extends string

    Parameters

    • keys: A[]

    Returns Partial<Pick<any, A>>

  • Type Parameters

    • A extends string

    Parameters

    • Rest ...keys: A[]

    Returns Partial<Pick<any, A>>

  • Parameters

    • fn: ((value: any, key: any, object: any) => any)
        • (value: any, key: any, object: any): any
        • Parameters

          • value: any
          • key: any
          • object: any

          Returns any

    Returns Partial<any>

  • For use with models as ES classes. If you define a preinitialize method, it will be invoked when the Model is first created, before any instantiation logic is run for the Model.

    See

    https://backbonejs.org/#Model-preinitialize

    Parameters

    • Optional attributes: any
    • Optional options: any

    Returns void

  • Type Parameters

    • A extends string

    Parameters

    • attribute: A

    Returns any

  • Returns Partial<any>

  • Parameters

    • Optional attributes: null | Partial<any>
    • Optional options: ModelSaveOptions

    Returns JQueryXHR

  • Send a custom msg over the comm.

    Parameters

    • content: JSONValue
    • Optional callbacks: ICallbacks
    • Optional buffers: ArrayBuffer[] | ArrayBufferView[]

    Returns void

  • Send a sync message to the kernel.

    If a message is sent successfully, this returns the message ID of that message. Otherwise it returns an empty string

    Parameters

    • state: JSONObject
    • callbacks: any = {}

    Returns string

  • Serialize widget state.

    A serializer is a function which takes in a state attribute and a widget, and synchronously returns a JSONable object. The returned object will have toJSON called if possible, and the final result should be a primitive object that is a snapshot of the widget state that may have binary array buffers.

    Parameters

    Returns JSONObject

  • Set one or more values.

    We just call the super method, in which val and options are optional. Handles both "key", value and {key: value} -style arguments.

    Parameters

    • key: any
    • Optional val: any
    • Optional options: any

    Returns any

  • Handle when a widget is updated from the backend.

    This function is meant for internal use only. Values set here will not be propagated on a sync.

    Parameters

    • state: Dict<unknown>

    Returns void

  • Parameters

    • Optional object: any
    • Optional events: string
    • Optional callback: EventHandler

    Returns DOMWidgetModel

  • Handle sync to the back-end. Called when a model.save() is called.

    Make sure a comm exists.

    Parameters

    method : create, update, patch, delete, read create/update always send the full attribute set patch - only send attributes listed in options.attrs, and if we are queuing up messages, combine with previous messages that have not been sent yet model : the model we are syncing will normally be the same as this options : dict the attrs key, if it exists, gives an {attr: value} dict that should be synced, otherwise, sync all attributes.

    Parameters

    Returns any

  • Serialize the model. See the deserialization function at the top of this file and the kernel-side serializer/deserializer.

    Parameters

    • Optional options: {}

      Returns string

    • Parameters

      • Optional eventName: string
      • Optional callback: EventHandler
      • Optional context: any

      Returns DOMWidgetModel

    • Parameters

      • attribute: string
      • Optional options: Silenceable

      Returns DOMWidgetModel

    • Parameters

      • attributes: Partial<any>
      • Optional options: any

      Returns any

    • Returns any[]

    • Do not use, prefer TypeScript's extend functionality.

      Parameters

      • properties: any
      • Optional classProperties: any

      Returns any

    Generated using TypeDoc