How to use najs-binding - 10 common examples

To help you get started, we’ve selected a few najs-binding examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github najs-framework / najs-eloquent / lib / providers / DriverProvider.ts View on Github external
protected createDriver(model: Object, driverClass: string, isGuarded: boolean): Driver {
    if (typeof this.driverInstances[driverClass] === 'undefined') {
      this.driverInstances[driverClass] = make>(driverClass, [model, isGuarded])
      // driver.createStaticMethods(Object.getPrototypeOf(model).constructor)
    }
    return this.driverInstances[driverClass]
  }
github najs-framework / najs-eloquent / dist / lib / providers / DriverProvider.js View on Github external
createDriver(model, driverClass, isGuarded) {
        if (typeof this.driverInstances[driverClass] === 'undefined') {
            this.driverInstances[driverClass] = najs_binding_1.make(driverClass, [model, isGuarded]);
            // driver.createStaticMethods(Object.getPrototypeOf(model).constructor)
        }
        return this.driverInstances[driverClass];
    }
    has(driver) {
github najs-framework / najs-eloquent / dist / lib / v0.x / eloquent / EloquentBase.js View on Github external
newInstance(data) {
        const instance = najs_binding_1.make(this.getClassName());
        instance.fillable = this.fillable;
        instance.guarded = this.guarded;
        return instance.initialize(data);
    }
    newCollection(dataset) {
github najs-framework / najs-eloquent / dist / lib / relations / RelationFactory.js View on Github external
getModelByNameOrDefinition(model) {
        if (typeof model === 'function') {
            return Reflect.construct(model, []);
        }
        return najs_binding_1.make(model);
    }
}
github najs-framework / najs-eloquent / lib / relations / RelationFactory.ts View on Github external
getModelByNameOrDefinition(model: string | Function): NajsEloquent.Model.IModel {
    if (typeof model === 'function') {
      return Reflect.construct(model as Function, [])
    }
    return make(model)
  }
}
github najs-framework / najs-eloquent / dist / lib / wrappers / QueryBuilderWrapper.js View on Github external
createRelationDataBucketIfNeeded() {
        if (!this.relationDataBucket) {
            this.relationDataBucket = najs_binding_1.make(constants_1.NajsEloquent.Relation.RelationDataBucket, []);
        }
        return this.relationDataBucket.register(this.recordName, this.modelName);
    }
    async first(id) {
github najs-framework / najs-eloquent / lib / relations / RelationFactory.ts View on Github external
setupRelation(className: string, setup: () => NajsEloquent.Relation.IRelation) {
    if (this.isSample) {
      return make(className, [this.rootModel, this.name])
    }

    if (!this.relation) {
      this.relation = setup()
    }
    return this.relation
  }
github najs-framework / najs-eloquent / dist / lib / providers / DriverProvider.js View on Github external
najs_binding_1.register(driver);
        }
        this.drivers[name] = {
            driverClassName: najs_binding_1.getClassName(driver),
            isDefault: isDefault
        };
        return this;
    }
    bind(model, driver) {
        this.binding[model] = driver;
        return this;
    }
}
DriverProvider.className = constants_1.NajsEloquent.Provider.DriverProvider;
exports.DriverProvider = DriverProvider;
najs_binding_1.register(DriverProvider, constants_1.NajsEloquent.Provider.DriverProvider);
github najs-framework / najs-eloquent / lib / providers / DriverProvider.ts View on Github external
if (typeof driver === 'function') {
      register(driver)
    }
    this.drivers[name] = {
      driverClassName: getClassName(driver),
      isDefault: isDefault
    }
    return this
  }

  bind(model: string, driver: string): this {
    this.binding[model] = driver
    return this
  }
}
register(DriverProvider, NajsEloquent.Provider.DriverProvider)
github najs-framework / najs-eloquent / dist / lib / providers / ComponentProvider.js View on Github external
index: count
        };
        return this;
    }
    bind(model, component) {
        if (typeof this.binding[model] === 'undefined') {
            this.binding[model] = [];
        }
        this.binding[model].push(component);
        this.binding[model] = functions_1.array_unique(this.binding[model]);
        return this;
    }
}
ComponentProvider.className = constants_1.NajsEloquent.Provider.ComponentProvider;
exports.ComponentProvider = ComponentProvider;
najs_binding_1.register(ComponentProvider);

najs-binding

> A simple and powerful dependency injection, service container, instance resolver for Node applications

MIT
Latest version published 7 years ago

Package Health Score

42 / 100
Full package analysis

Popular najs-binding functions

Similar packages