Skip to content

Instantly share code, notes, and snippets.

View seven-cd's full-sized avatar

SCD seven-cd

  • nsoft
  • Mostar
View GitHub Profile
@seven-cd
seven-cd / angular-js-one-time-binding.js
Created March 5, 2017 13:35
AngularJs - One Time Watcher
var configWatcher = $scope.$watch(function() {
return config.game;
}, function(current) {
if (current) {
vm.ready = true;
configWatcher();
}
});
var configWatcher = $scope.$watch(function() {
return config.game;
}, function(current) {
if (current) {
vm.ready = true;
configWatcher();
}
});
this.validate = function() {
var defer = $q.defer();
service.getStatus().then(
function() {
defer.resolve();
},
function(response) {
defer.reject({
message: response.message
this.validate = function() {
return service.getStatus().then(function(response) {
return response.data;
}).catch(function(response) {
return response.message;
});
}
this.validate = function() {
return service.getStatus().then(function(response) {
return response.data;
});
};
getContainers(params, meta) {
let query = resourceQueries.loadQuery('selectContainers');
let connection;
return dbConnect.getConnectionAsync().then((dbConnection) => {
connection = dbConnection;
return connection.queryAsync(query, params).then((result) => {
return resourceParser.parseContainersFromDb(result);
});
}).catch((exception) => {
function preload(source) {
var deferred = $q.defer();
var img = angular.element('<img>');
img.on('load', deferred.resolve);
img.on('error', deferred.reject);
img.attr('src', source);
return deferred.promise;
}
function preload(source) {
return $q(function(resolve, reject) {
var img = angular.element('<img>');
img.on('load', resolve);
img.on('error', reject);
img.attr('src', source);
});
}
const pmx = require('pmx');
pmx.action('SevenService:ConfirmTransaction', (reply) => {
// You must reply to action
reply({success : true});
});
pmx.action('SevenService:ConfirmTransaction', (param, reply) => {
reply({success : param});
});