Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Langer committed Jan 29, 2018
1 parent d453e0b commit 91aa062
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
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)

0 comments on commit 91aa062

Please sign in to comment.