Files
ihrm/node_modules/alpinejs/src/datas.js
Nikhil Ravi Cybrosys e1794e7422 [UPDT]translations in the views (#4)
[UPDT]Translations in the views
[FIX]major bug fixes
2023-05-18 15:05:28 +05:30

23 lines
457 B
JavaScript
Executable File

let datas = {}
export function data(name, callback) {
datas[name] = callback
}
export function injectDataProviders(obj, context) {
Object.entries(datas).forEach(([name, callback]) => {
Object.defineProperty(obj, name, {
get() {
return (...args) => {
return callback.bind(context)(...args)
}
},
enumerable: false,
})
})
return obj
}