You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been bothered (conceptually, not yet in reality) by an API concern in possum. stampit provides a powerful and convenient strategy to hide your internal variables and methods from the outside world via the .init() block. When possum offers a .states() block, wherein some handlers might invoke functions defined in the .methods() block...
model=possum().config({initialState: 'uninit'}).methods({someFunc: function(){}}).states({'uninit': {init: function(args){this.someFunc()}}}).create()model.someFunc()// valid, though it probably isn't intended to be
... implementers are forced (by default) to expose their internal api. A possum is powerful because it exposes a consistent api via .handle()- which becomes quickly muddied as soon as you use a .methods() block.
Not a huge complain, but it would be neat to have external consumers of a possum be limited literally to possumInstance.handle() and possumInstance.currentState.
The text was updated successfully, but these errors were encountered:
I think I understand your concerns. My initial thought is that you dont have to put everything onto possum directly. You can information hide either by using the state facility I added, or you can use proper modules which are intended for this sort of thing:
//mymodule.js
function myFunc(){}
export default possum().config({
initialState: 'uninit'
})
.states({
'uninit': {
init: function (args) {
someFunc()
}
}
}).create()
That said, I will consider exposing access to the states collection so you can manipulate it in the init call. I am not sure I like this yet because I really want to keep possum single concerned and let app developer work out their problems of information hiding, etc.
I've been bothered (conceptually, not yet in reality) by an API concern in possum.
stampit
provides a powerful and convenient strategy to hide your internal variables and methods from the outside world via the.init()
block. When possum offers a.states()
block, wherein some handlers might invoke functions defined in the.methods()
block...... implementers are forced (by default) to expose their internal api. A possum is powerful because it exposes a consistent api via
.handle()
- which becomes quickly muddied as soon as you use a.methods()
block.Not a huge complain, but it would be neat to have external consumers of a possum be limited literally to
possumInstance.handle()
andpossumInstance.currentState
.The text was updated successfully, but these errors were encountered: