Overriding onDropItem & onSortItem

You'd override them in your sheet class.
UU
Unknown User807d ago
M
Mana807d ago
There's no such thing as preventDefault() global function. Overriding itself prevents the normal function unless you call it.
UU
Unknown User807d ago
C
Calego807d ago
This is what that super thing you've seen around is for. Without the "super.whatever()", you're completely overriding the method and none of the inherited behavior will fire
C
Calego807d ago
super - JavaScript | MDN
The super keyword is used to access and call functions on an object's parent.
C
Calego807d ago
class MySheetClass extends ActorSheet {
// ...

/** Extends `activateListeners` with additional logic */
activateListeners(html) {
super.activateListeners(html); // effectively calling `ActorSheet`'s `activateListeners` method

_someOtherMethod(html);
}

/** Replaces `_onDropItem` with different logic */
_onDropItem() {
// custom logic without the `super`
}
}
class MySheetClass extends ActorSheet {
// ...

/** Extends `activateListeners` with additional logic */
activateListeners(html) {
super.activateListeners(html); // effectively calling `ActorSheet`'s `activateListeners` method

_someOtherMethod(html);
}

/** Replaces `_onDropItem` with different logic */
_onDropItem() {
// custom logic without the `super`
}
}
What you saw with Inventory+ and libwrapper is how modules tend to override methods in existing classes which they do not control. Inventory+ doesn't have control of the ActorSheet5e class, so it had to work around that by 'monkeypatching' the method after it's already been defined. Since you're writing a system, it's unlikely you'll need libwrapper. Systems are the first-class citizens and don't really worry much about conflicts, modules are second class and do have to worry about conflicts.
UU
Unknown User807d ago
Want results from more Discord servers?
Add your server
More Posts
getter & setter wrapper for settingsI'm trying to use a getter & setter pair as an interface for `game.settings.get` and `game.settings.scrollable tab contentsIt is possible, and you're firmly in the css and DOM structure side of development with this line ofJr devI'm cleaning out my bookmarks and accidentally came back to this article. Potentially useful startinHTCPackage: `hero-creation-tool`System Specific CSSI'm not 100% about this, but it is worth watching out that your solution doesn't actually end up beiadvancement-wipCommander register apitalking about permissions, im working on the registering api for the Commander, and I wanted to ask Azgaars Blurry MapHey all. I'm taking a look at my importer for Azgaar's Fantasy Map Generator and wondering how I canccjmk overlaybut for what I wanted I think I *needed* to append it there so that I can overlay the whole screencliits very very early alpha demoMonarch APIAlright, adventurous ones: I have a Beta version of Monarch with the new components API! Manifest: compacted chat cardsModules create problems to solve problems... Today's problem: "When I roll an attack, it eats the whdragdrop shenneneginsRight now, a user can drag a spell onto their character sheet. I store that in a 'spell' array and leffect mini modulesI've gotten to the point where I'm confident in releasing a slurry of tiny no-config Active Effect rdamage application hooksNew 5e Hook ideas, gimme yer thoughts: `Hooks.call('Actor5e.preDamageApplied')` args: `damageAmounthook conventionsRegarding hooks, is the convention that _all_ `pre...` hooks are executed on the machine that initiaexpand arraysIs there a way to `expandObject` except for an Array?edit-owned-item-effectI've made an abomination. This hacks its way past the limitations surrounding editing effects on ownItem Pile feedbackSimple is king!effects to chat@badideasbureau is the `temporary` flag you look for in Effects to Chat a convention from somewhere