-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sebastian Langer
committed
Jan 29, 2018
1 parent
d453e0b
commit 91aa062
Showing
1 changed file
with
31 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# shopware-typedef | ||
|
||
> Shopware Typescript typings | ||
```bash | ||
npm install --save-dev shopware-typedef | ||
``` | ||
|
||
In your code it should probably look somethin like this: | ||
|
||
```typescript | ||
/// <reference types="shopware-typedef"/> | ||
|
||
export class ScnFoo extends $.PluginBase implements SwPluginDefinition { | ||
init(){ | ||
console.log('hello, world!'); | ||
} | ||
} | ||
|
||
$.plugin('scnFoo', ScnFoo.prototype); | ||
|
||
declare global { | ||
interface JQuery { scnFoo(): JQuery } | ||
interface SwPluginsCollection { scnFoo: ScnFoo } | ||
} | ||
``` | ||
|
||
And that's about all to do for adding a plugin. Have a look into the example.ts for more help. | ||
|
||
Also, be aware that you can't yet pass `$.plugin()` a constructor as a second argument. There's already an issue at shopware for that: [#1489](https://github.com/shopware/shopware/pull/1489) | ||
|