Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Proposal: Achievements API #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,38 @@ import { Event, IEvent } from "oni-types"

export type DisposeFunction = () => void

/**
* API surface area for our Achievements integration
*/
export namespace Achievements {

/**
* Definition of an achievement
*
* An achievement consists of a name, title, along with one or more sub goals
*/
export interface Definition {
uniqueId: string
name: string
description: string

goals: Goal[]
}

export interface Goal {
name: string
goalId: string
count: number
}

export interface Api {
notifyGoal(goalId: string): void
registerAchievement(definition: Definition): void

onAchievementAccomplished: IEvent<Definition>
}
}

/**
* API surface area for registering and executing commands
*/
Expand Down Expand Up @@ -574,6 +606,7 @@ export namespace Plugin {
}

export interface Api extends EventEmitter {
achievements: Achievements.Api
automation: Automation.Api
colors: IColors
commands: Commands.Api
Expand Down