pwix:orderable-stack
What is it ?
This Meteor packages defines an IOrderableStack
interface and provides a OrderableStack
implementation of this interface.
Note: this could be as well just a pure NPM package (todo#1: to do another day).
Configuration
The package's behavior can be configured through a call to the OrderableStack.configure()
method, with just a single javascript object argument, which itself should only contains the options you want override.
Known configuration options are:
-
verbosity
Define the expected verbosity level.
The accepted value can be any or-ed combination of following:
-
OrderableStack.C.Verbose.NONE
Do not display any trace log to the console
-
OrderableStack.C.Verbose.CONFIGURE
Trace
OrderableStack.configure()
calls and their result
-
Please note that OrderableStack.configure()
method should be called in the same terms both in client and server sides.
Remind too that Meteor packages are instanciated at application level. They are so only configurable once, or, in other words, only one instance has to be or can be configured. Addtionnal calls to OrderableStack.configure()
will just override the previous one. You have been warned: only the application should configure a package.
Provides
The OrderableStack
global object provides following items:
Methods
OrderableStack.configure()
See above.
OrderableStack.i18n.namespace()
A function which returns the i18n namespace used by the package. Used to add translations at runtime.
Classes
OrderableStack.Orderable
A pure virtual class which implements the IOrderable
interface.
This class MUST be derived, and a IOrderableCompare()
function MUST be provided by the derived class.
OrderableStack.OrderableStack
A class which implements the IOrderableStack
interface.
OrderableStack.Stack
A class which implements the IStack
interface.
Interfaces
OrderableStack.IOrderable
An interface which let an object provides its own personal semantic order.
It provides following methods:
-
IOrderableCompare()
A standard comparison function which must returns the usual sort result:
- -1 if
a
lesser thanb
- -1 if
a
equalb
- +1 if
a
greater thanb
.
Please note that provided
a
andb
arguments areIOrderableStack
objects with following keys:idx
: the index of the object in the underlyingIStack
object, the greater being the most recento
: the object itself.
This interface MUST be implemented by any object which will want take advantage of the
IOrderableStack
interface. - -1 if
OrderableStack.IOrderableStack
An interface which manages an IStack
of IOrderable
's.
It provides following methods:
-
IOrderableStackLast()
Returns the topmost object of the stack in the semantic order as provided by
IOrderable
interface.
OrderableStack.IStack
A very simple interface to manage a stack of objects.
It provides following methods:
-
IStackClear()
Clears the content of the stack.
-
IStackDump()
Dump the content of the stack to the console.
-
IStackLast()
Returns the last object of the stack.
-
IStackPull()
Remove (and returns) the last object of the stack.
-
IStackPush( o )
Add an object at the end of the stack.
Blaze components
OrderableStack
Display the top message of the stack.
Parameters can be provided:
- label, defaulting to 'Cookies management policy'
- title, defaulting to 'Cookies management policy'
- route, defaulting to configured routePrefix + '/cookies'.
NPM peer dependencies
Starting with v 0.3.0, and in accordance with advices from the Meteor Guide, we no more hardcode NPM dependencies in the Npm.depends
clause of the package.js
.
Instead we check npm versions of installed packages at runtime, on server startup, in development environment.
Dependencies as of v 1.0.0:
'lodash': '^4.17.0', '@vestergaard-company/js-mixin': '^1.0.3'
Each of these dependencies should be installed at application level:
meteor npm install <package> --save
Translations
New and updated translations are willingly accepted, and more than welcome. Just be kind enough to submit a PR on the Github repository.
Cookies and comparable technologies
None at the moment.
P. Wieser
- Last updated on 2024, Jun. 10th