How to use oni-types - 4 common examples

To help you get started, we’ve selected a few oni-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github onivim / oni / browser / src / Services / Search / index.tsx View on Github external
export function activate(oni: any): any {
    const onFocusEvent = new Event()

    const oniApi: Oni.Plugin.Api = oni

    // TODO: Add sidebar.add to the API and use oniApi instead of oni
    oni.sidebar.add("search", new SearchPane(onFocusEvent, oni))

    const sidebarManager = getSidebarManager() // TODO: Remove

    const searchAllFiles = () => {
        sidebarManager.toggleVisibilityById("oni.sidebar.search") // TODO: Use oni-api instead
        // TODO: Add sidebar.setActiveEntry to the API and use oni as Oni (API)
        // oni.sidebar.setActiveEntry("oni.sidebar.search")
        onFocusEvent.dispatch()
    }

    oniApi.commands.registerCommand({
github onivim / oni / ui-tests / mocks / EditorManager.ts View on Github external
import { Event } from "oni-types"
import { EditorManager } from "./../../browser/src/Services/EditorManager"

const _onBufferSaved = new Event("Test:ActiveEditor-BufferSaved")
const _onBufferEnter = new Event("Test:ActiveEditor-BufferEnter")
const _onQuit = new Event()

const MockEditorManager = jest.fn().mockImplementation(() => ({
    activeEditor: {
        onQuit: _onQuit,
        activeBuffer: {
            filePath: "test.txt",
        },
        onBufferEnter: _onBufferEnter,
        onBufferSaved: _onBufferSaved,
        restoreSession: jest.fn(),
        persistSession: jest.fn(),
        getCurrentSession: jest.fn().mockReturnValue("test-session"),
    },
}))

export default MockEditorManager
github onivim / oni / browser / src / Services / Language / LanguageManager.ts View on Github external
public subscribeToLanguageServerNotification(
        protocolMessage: string,
        callback: (args: ILanguageServerNotificationResponse) => void,
    ): IDisposable {
        const currentSubscription = this._notificationSubscriptions[protocolMessage]

        if (!currentSubscription) {
            const evt = new Event()
            this._notificationSubscriptions[protocolMessage] = evt

            const languageClients = Object.values(this._languageServerInfo)
            languageClients.forEach(ls => {
                ls.subscribe(protocolMessage, evt)
            })

            return evt.subscribe(args => callback(args))
        } else {
            return currentSubscription.subscribe(args => callback(args))
        }
    }
github onivim / oni / browser / src / Services / Configuration / Configuration.ts View on Github external
public registerSetting(
        name: string,
        options: IConfigurationSettingMetadata = DefaultConfigurationSettings,
    ): IConfigurationSetting {
        this._settingMetadata[name] = options

        const currentValue = this.getValue(name, null)

        if (options.defaultValue && currentValue === null) {
            this.setValue(name, options.defaultValue)
        }

        const newEvent = new Event>()
        const subs: Array>> =
            this._subscriptions[name] || []
        this._subscriptions[name] = [...subs, newEvent]

        const dispose = () => {
            this._subscriptions[name] = this._subscriptions[name].filter(e => e !== newEvent)
        }

        const getValue = () => {
            return this.getValue(name)
        }

        return {
            onValueChanged: newEvent,
            dispose,
            getValue,

oni-types

Shared types and interfaces used across Oni

MIT
Latest version published 6 years ago

Package Health Score

42 / 100
Full package analysis

Popular oni-types functions

Similar packages