This repository has been archived by the owner on Apr 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9333a35
commit e73f411
Showing
5 changed files
with
124 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* Vue-Events types. | ||
*/ | ||
|
||
import Vue, { ComponentOptions, PluginFunction } from 'vue'; | ||
|
||
export declare class VueEvents { | ||
static install: PluginFunction<never>; | ||
|
||
/** | ||
* Emit the given event. | ||
* | ||
* @param {string|object} event | ||
* @param {...*} args | ||
* @memberof VueEvents | ||
*/ | ||
$emit(event: string, ...args): void; | ||
|
||
/** | ||
* @borrows $emit as emit | ||
*/ | ||
emit(event: string, ...args): void; | ||
|
||
/** | ||
* @borrows emit as fire | ||
*/ | ||
fire(event: string, ...args): void; | ||
|
||
/** | ||
* Listen for the given event. | ||
* | ||
* @param {string} event | ||
* @param {() => void} callback | ||
* @memberof VueEvents | ||
*/ | ||
$on(event: string, callback: () => void): void; | ||
|
||
/** | ||
* @borrows $on as on | ||
*/ | ||
on(event: string, callback: () => void): void; | ||
|
||
/** | ||
* @borrows on as listen | ||
*/ | ||
listen(event: string, callback: () => void): void; | ||
|
||
/** | ||
* Listen for the given event once. | ||
* | ||
* @param {string} event | ||
* @param {() => void} callback | ||
*/ | ||
$once(event: string, callback: () => void): void; | ||
|
||
/** | ||
* @borrows $once as once | ||
*/ | ||
once(event: string, callback: () => void): void; | ||
|
||
/** | ||
* Remove one or more event listeners. | ||
* | ||
* @param {string} event | ||
* @param {() => void} callback | ||
*/ | ||
$off(event:string, callback: () => void): void; | ||
|
||
/** | ||
* @borrows $off as off | ||
*/ | ||
off(event:string, callback: () => void): void; | ||
|
||
/** | ||
* @borrows off as remove | ||
*/ | ||
remove(event:string, callback: () => void): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Extends interfaces in Vue.js | ||
*/ | ||
import './vue'; | ||
import * as E from './events'; | ||
|
||
declare namespace VueEvents { | ||
export type VueEvents = E.VueEvents; | ||
} | ||
|
||
declare class VueEvents extends E.VueEvents {} | ||
|
||
export default VueEvents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Augment the typings of Vue.js | ||
*/ | ||
|
||
import Vue from 'vue'; | ||
import VueEvents from './index'; | ||
|
||
declare module 'vue/types/vue' { | ||
interface Vue { | ||
$events: VueEvents | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
abbrev@1: | ||
version "1.0.9" | ||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" | ||
|
@@ -882,7 +884,7 @@ inflight@^1.0.4: | |
once "^1.3.0" | ||
wrappy "1" | ||
|
||
inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1, inherits@2: | ||
inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1: | ||
version "2.0.3" | ||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" | ||
|
||
|
@@ -973,7 +975,7 @@ is-typedarray@~1.0.0: | |
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" | ||
|
||
isarray@~1.0.0, [email protected]: | ||
[email protected], isarray@~1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" | ||
|
||
|
@@ -1083,15 +1085,15 @@ minimatch@^3.0.0, minimatch@^3.0.2: | |
dependencies: | ||
brace-expansion "^1.0.0" | ||
|
||
minimist@^1.2.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" | ||
|
||
[email protected]: | ||
version "0.0.8" | ||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" | ||
|
||
mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.1: | ||
minimist@^1.2.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" | ||
|
||
"mkdirp@>=0.5 0", mkdirp@^0.5.1, mkdirp@~0.5.1: | ||
version "0.5.1" | ||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" | ||
dependencies: | ||
|
@@ -1361,7 +1363,7 @@ request@^2.79.0: | |
tunnel-agent "~0.4.1" | ||
uuid "^3.0.0" | ||
|
||
rimraf@~2.5.1, rimraf@~2.5.4, rimraf@2: | ||
rimraf@2, rimraf@~2.5.1, rimraf@~2.5.4: | ||
version "2.5.4" | ||
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" | ||
dependencies: | ||
|
@@ -1418,10 +1420,6 @@ sshpk@^1.7.0: | |
jsbn "~0.1.0" | ||
tweetnacl "~0.14.0" | ||
|
||
string_decoder@~0.10.x: | ||
version "0.10.31" | ||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" | ||
|
||
string-width@^1.0.1: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" | ||
|
@@ -1430,6 +1428,10 @@ string-width@^1.0.1: | |
is-fullwidth-code-point "^1.0.0" | ||
strip-ansi "^3.0.0" | ||
|
||
string_decoder@~0.10.x: | ||
version "0.10.31" | ||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" | ||
|
||
stringstream@~0.0.4: | ||
version "0.0.5" | ||
resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" | ||
|
@@ -1519,6 +1521,10 @@ [email protected]: | |
dependencies: | ||
extsprintf "1.0.2" | ||
|
||
vue@^2.5.2: | ||
version "2.5.2" | ||
resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.2.tgz#fd367a87bae7535e47f9dc5c9ec3b496e5feb5a4" | ||
|
||
wide-align@^1.1.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad" | ||
|
@@ -1532,4 +1538,3 @@ wrappy@1: | |
xtend@^4.0.0: | ||
version "4.0.1" | ||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" | ||
|