Skip to content

Commit

Permalink
chore(Hexo): add event emitter descriptor (#5302)
Browse files Browse the repository at this point in the history
Co-authored-by: uiolee <[email protected]>
  • Loading branch information
dimaslanjaka and uiolee authored Jan 9, 2024
1 parent 0c62370 commit 15dc6ca
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions lib/hexo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,88 @@ declare module 'module' {
_cache: any;
}

interface Hexo {

/**
* Emitted before deployment begins.
* @param event
* @param listener
* @link https://hexo.io/api/events.html#deployBefore
*/
on(event: 'deployBefore', listener: (...args: any[]) => any): this;

/**
* Emitted after deployment begins.
* @param event
* @param listener
* @link https://hexo.io/api/events.html#deployAfter
*/
on(event: 'deployAfter', listener: (...args: any[]) => any): this;

/**
* Emitted before Hexo exits.
* @param event
* @param listener
* @link https://hexo.io/api/events.html#exit
*/
on(event: 'exit', listener: (...args: any[]) => any): this;

/**
* Emitted before generation begins.
* @param event
* @param listener
* @link https://hexo.io/api/events.html#generateBefore
*/
on(event: 'generateBefore', listener: (...args: any[]) => any): this;

/**
* Emitted after generation finishes.
* @param event
* @param listener
* @link https://hexo.io/api/events.html#generateAfter
*/
on(event: 'generateAfter', listener: (...args: any[]) => any): this;

/**
* Emitted after a new post has been created. This event returns the post data:
* @param event
* @param listener
* @link https://hexo.io/api/events.html#new
*/
on(event: 'new', listener: (post: { path: string; content: string; }) => any): this;

/**
* Emitted before processing begins. This event returns a path representing the root directory of the box.
* @param event
* @param listener
* @link https://hexo.io/api/events.html#processBefore
*/
on(event: 'processBefore', listener: (...args: any[]) => any): this;

/**
* Emitted after processing finishes. This event returns a path representing the root directory of the box.
* @param event
* @param listener
* @link https://hexo.io/api/events.html#processAfter
*/
on(event: 'processAfter', listener: (...args: any[]) => any): this;

/**
* Emitted after initialization finishes.
* @param event
* @param listener
*/
on(event: 'ready', listener: (...args: any[]) => any): this;

/**
* undescripted on emit
* @param event
* @param listener
*/
on(event: string, listener: (...args: any[]) => any): any;
emit(event: string, ...args: any[]): any;
}

class Hexo extends EventEmitter {
public base_dir: string;
public public_dir: string;
Expand Down

0 comments on commit 15dc6ca

Please sign in to comment.